1 Preparations

# load library
library(tidyverse)
library(afex)
library(lme4)
library(lmerTest)
library(emmeans)

2 Load and clean data

2.1 Data from localizer scans

2.2 Data for univariate analyses

2.3 Data from CoSMoMVPA

3 ROI information

3.1 Label used for each ROI

# Experiment 1
label_lFFA_E1 <- label_lFFA[1] # "roi.lh.f20.f-vs-o.label" "roi.lh.f40.f-vs-o.label"
label_rFFA_E1 <- label_rFFA[1] # "roi.rh.f20.f-vs-o.label" "roi.rh.f40.f-vs-o.label"

label_lFFA1_E1 <- label_lFFA1[1] # "roi.lh.f13.f-vs-o.ffa1.label" "roi.lh.f20.f-vs-o.ffa1.label"
label_rFFA1_E1 <- label_rFFA1[1] # "roi.rh.f13.f-vs-o.ffa1.label"

label_lFFA2_E1 <- label_lFFA2[1] # "roi.lh.f13.f-vs-o.ffa2.label"
label_rFFA2_E1 <- label_rFFA2[1] # "roi.rh.f20.f-vs-o.ffa2.label" "roi.rh.f40.f-vs-o.ffa2.label"

label_VWFA_E1 <- label_lVWFA[1] # "roi.lh.f13.w-vs-o.label"

label_lLOC_E1 <- label_lLOC[1] # "roi.lh.f13.o-vs-scr.label"
label_rLOC_E1 <- label_rLOC[1] # "roi.rh.f13.o-vs-scr.label"

# Experiment 2
label_lFFA_E2 <- label_lFFA[1] # "roi.lh.f20.f-vs-o.label" "roi.lh.f40.f-vs-o.label"
label_rFFA_E2 <- label_rFFA[1] # "roi.rh.f20.f-vs-o.label" "roi.rh.f40.f-vs-o.label"

label_lFFA1_E2 <- label_lFFA1[1] # "roi.lh.f13.f-vs-o.ffa1.label" "roi.lh.f20.f-vs-o.ffa1.label"
label_rFFA1_E2 <- label_rFFA1[1] # "roi.rh.f13.f-vs-o.ffa1.label"

label_lFFA2_E2 <- label_lFFA2[1] # "roi.lh.f13.f-vs-o.ffa2.label"
label_rFFA2_E2 <- label_rFFA2[1] # "roi.rh.f20.f-vs-o.ffa2.label" "roi.rh.f40.f-vs-o.ffa2.label"

label_VWFA_E2 <- label_lVWFA[1] # "roi.lh.f13.w-vs-o.label"

label_lLOC_E2 <- label_lLOC[1] # "roi.lh.f13.o-vs-scr.label"
label_rLOC_E2 <- label_rLOC[1] # "roi.rh.f13.o-vs-scr.label"

ROI <- factor(c("FFA", "FFA1", "FFA2", "VWFA", "LOC"), levels = ROIOrder)
left_E1 <- c(label_lFFA_E1, label_lFFA1_E1, label_lFFA2_E1, label_VWFA_E1, label_lLOC_E1)
right_E1 <- c(label_rFFA_E1, label_rFFA1_E1, label_rFFA2_E1, 'NA', label_rLOC_E1)
left_E2 <- c(label_lFFA_E2, label_lFFA1_E2, label_lFFA2_E2, label_VWFA_E2, label_lLOC_E2)
right_E2 <- c(label_rFFA_E2, label_rFFA1_E2, label_rFFA2_E2, 'NA', label_rLOC_E2)

label_ROI <- tibble("ROI" = ROI, "left_E1" = left_E1, "right_E1"= right_E1, "left_E2" = left_E2, "right_E2" = right_E2)

label_ROI

3.2 Size of labels

roi_info %>% 
  select(-nVertices) %>% 
  spread(Label, LabelSize) 

3.3 Number of vertices for each label

roi_info %>% 
  select(-LabelSize) %>% 
  spread(Label, nVertices) 

3.4 Number of subjects

# desc_mvpa_acc %>% 
#   select(ExpCode, Label, Count) %>% 
#   distinct() %>%
#   spread(Label, Count) 

desc_mvpa_acc %>%
  select(ExpCode, Label, Count) %>% 
  distinct() %>% 
  filter(Label %in% c(left_E1, right_E1, left_E2, right_E2)) %>% 
  mutate(Hemi = substr(Label, 5,6),
         Hemisphere = if_else(Hemi == "lh", "left", if_else(Hemi == "rh", "right", "NA")),
         Col_name = paste(Hemisphere, paste0("E", ExpCode), sep = "_"),
         ROI = if_else(grepl("ffa1", Label), "FFA1", 
                       if_else(grepl("ffa2", Label), "FFA2", 
                               if_else(grepl("w-vs-o", Label), "VWFA", 
                                       if_else(grepl("o-vs-scr", Label), "LOC",
                                               "FFA")))), 
         ROI = factor(ROI, levels = ROIOrder)) %>% 
  select(ROI, Col_name, Count) %>% 
  spread(Col_name, Count) %>% 
  select(ROI, left_E1, right_E1, everything()) 

3.5 Number of subjects excluded

# df_mvpa %>%
#   filter(nVertices < nVtx_min) %>% # remove the label whose vertex number is smaller than nVtx_min
#   select(ExpCode, Label, SubjCode) %>%
#   distinct() %>%
#   group_by(ExpCode, Label) %>%
#   summarize(Count = n()) %>%
#   ungroup() %>% 
#   spread(Label, Count)

df_mvpa %>%
  filter(nVertices < nVtx_min) %>% # remove the label whose vertex number is smaller than nVtx_min
  select(ExpCode, Label, SubjCode) %>%
  distinct() %>%
  group_by(ExpCode, Label) %>%
  summarize(Count = n()) %>% 
  ungroup() %>% 
  filter(Label %in% c(left_E1, right_E1, left_E2, right_E2)) %>% 
  mutate(Hemi = substr(Label, 5,6),
         Hemisphere = if_else(Hemi == "lh", "left", if_else(Hemi == "rh", "right", "NA")),
         Col_name = paste(Hemisphere, paste0("E", ExpCode), sep = "_"),
         ROI = if_else(grepl("ffa1", Label), "FFA1", 
                       if_else(grepl("ffa2", Label), "FFA2", 
                               if_else(grepl("w-vs-o", Label), "VWFA", 
                                       if_else(grepl("o-vs-scr", Label), "LOC",
                                               "FFA")))),
         ROI = factor(ROI, levels = ROIOrder)) %>%  
  select(ROI, Col_name, Count) %>% 
  spread(Col_name, Count) %>% 
  select(ROI, left_E1, right_E1, everything()) 

4 Experiment 1: faces and words

4.1 Localizer (Univariate analyses)

df_loc_E1 <- {
  df_clean_loc %>%  
    filter(ExpCode == 1) %>% 
    mutate(SubjCode = as.factor(SubjCode))
}
# nlevels(df_loc_E1$SubjCode) # number of subjects

The ROI (label) used for this analysis is .

4.1.1 rm-ANOVA

anova_loc_E1 <- aov_4(Resp ~ Conditions + (Conditions | SubjCode), data = df_loc_E1)

anova_loc_E1
## Anova Table (Type 3 tests)
## 
## Response: Resp
##       Effect          df  MSE         F ges p.value
## 1 Conditions 2.09, 35.56 0.10 68.78 *** .44  <.0001
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
## 
## Sphericity correction method: GG
emm_loc_anova_E1 <- emmeans(anova_loc_E1, ~ Conditions)

emm_loc_anova_E1
##  Conditions emmean    SE   df lower.CL upper.CL
##  face         2.00 0.121 25.8    1.753     2.25
##  object       1.18 0.121 25.8    0.933     1.43
##  word         1.13 0.121 25.8    0.879     1.37
##  scrambled    0.80 0.121 25.8    0.552     1.05
## 
## Warning: EMMs are biased unless design is perfectly balanced 
## Confidence level used: 0.95
contrast(emm_loc_anova_E1, "pairwise")
##  contrast           estimate     SE df t.ratio p.value
##  face - object        0.8198 0.0871 51  9.412  <.0001 
##  face - word          0.8738 0.0871 51 10.032  <.0001 
##  face - scrambled     1.2004 0.0871 51 13.782  <.0001 
##  object - word        0.0539 0.0871 51  0.619  0.9255 
##  object - scrambled   0.3806 0.0871 51  4.369  0.0003 
##  word - scrambled     0.3266 0.0871 51  3.750  0.0025 
## 
## P value adjustment: tukey method for comparing a family of 4 estimates

4.1.2 Linear mixed model

lmm_loc_E1 <- lmer(Resp ~ Conditions + (1 | SubjCode), data = df_loc_E1)

summary(lmm_loc_E1)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: Resp ~ Conditions + (1 | SubjCode)
##    Data: df_loc_E1
## 
## REML criterion at convergence: 64.7
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.58483 -0.57796  0.07962  0.58844  1.71453 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  SubjCode (Intercept) 0.19325  0.4396  
##  Residual             0.06828  0.2613  
## Number of obs: 72, groups:  SubjCode, 18
## 
## Fixed effects:
##                     Estimate Std. Error      df t value Pr(>|t|)    
## (Intercept)           2.0006     0.1205 25.7772  16.597 2.81e-15 ***
## Conditionsobject     -0.8198     0.0871 51.0000  -9.412 9.76e-13 ***
## Conditionsword       -0.8738     0.0871 51.0000 -10.032 1.16e-13 ***
## Conditionsscrambled  -1.2004     0.0871 51.0000 -13.782  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) Cndtnsb Cndtnsw
## Condtnsbjct -0.361                
## Conditnswrd -0.361  0.500         
## Cndtnsscrmb -0.361  0.500   0.500
emm_loc_lmm_E1 <- emmeans(lmm_loc_E1, ~ Conditions)

emm_loc_lmm_E1
##  Conditions emmean    SE   df lower.CL upper.CL
##  face         2.00 0.121 25.8    1.753     2.25
##  object       1.18 0.121 25.8    0.933     1.43
##  word         1.13 0.121 25.8    0.879     1.37
##  scrambled    0.80 0.121 25.8    0.552     1.05
## 
## Degrees-of-freedom method: kenward-roger 
## Confidence level used: 0.95
contrast(emm_loc_lmm_E1, "pairwise")
##  contrast           estimate     SE df t.ratio p.value
##  face - object        0.8198 0.0871 51  9.412  <.0001 
##  face - word          0.8738 0.0871 51 10.032  <.0001 
##  face - scrambled     1.2004 0.0871 51 13.782  <.0001 
##  object - word        0.0539 0.0871 51  0.619  0.9255 
##  object - scrambled   0.3806 0.0871 51  4.369  0.0003 
##  word - scrambled     0.3266 0.0871 51  3.750  0.0025 
## 
## Degrees-of-freedom method: kenward-roger 
## P value adjustment: tukey method for comparing a family of 4 estimates

4.1.3 Plot

plot_loc_E1 <- {
  ggplot(data = as.data.frame(emm_loc_anova_E1), aes(y = emmean, x = Conditions)) + # set the data, varialbes for x and y axises
    geom_col(position = "dodge", color = "black", alpha = .7) +  # position of columns and countour of columns
    geom_errorbar(mapping = aes(ymin = lower.CL, ymax = upper.CL), linetype = 1,  # set the error bar
                  show.legend = FALSE, width = 0.25, alpha = .5,
                  position = position_dodge(width=0.9)) +
    scale_y_continuous(expand= c(0, 0), limits = c(0, activationUL), breaks = seq(0, 3, .5)) +  # remove the space between columns and x axis
    labs(title = "", x = "Stimuli", y = "Neural Responses") +  # set the names for main, x and y axises Subjective Responses for E205
    general_theme
}

plot_loc_E1

4.2 Main runs

# only keep data of E1
df_univar_E1 <- {
  df_clean_univar %>% 
    filter(ExpCode == 1) %>% 
    mutate(FaceWord = factor(FaceWord, levels = facewordOrder),
           SubjCode = as.factor(SubjCode))
}

df_univar_agg_E1 <- {
  df_univar_agg %>% 
    filter(ExpCode == 1) %>% 
    mutate(FaceWord = factor(FaceWord, levels = facewordOrder),
           SubjCode = as.factor(SubjCode))
}
# only keep data of E1
df_mvpa_E1 <- {
  df_clean_mvpa %>% 
    filter(ExpCode == 1) %>% 
    mutate(ClassifyPair = factor(ClassifyPair, levels = pairOrder_E1),
           SubjCode = as.factor(SubjCode))
}

df_mvpa_acc_E1 <- {
  df_mvpa_acc %>% 
    filter(ExpCode == 1) %>% 
    mutate(ClassifyPair = factor(ClassifyPair, levels = pairOrder_E1),
           SubjCode = as.factor(SubjCode))
}

desc_mvpa_acc_E1 <- {
  desc_mvpa_acc %>% 
    filter(ExpCode == 1) %>% 
    mutate(ClassifyPair = factor(ClassifyPair, levels = pairOrder_E1)) %>% 
    arrange(ExpCode, Hemisphere, Label, ClassifyPair) 
}

4.2.1 Label:FFA

# label_lFFA_E1 <- label_lFFA[1] # "roi.lh.f20.f-vs-o.label" "roi.lh.f40.f-vs-o.label"
# label_rFFA_E1 <- label_rFFA[1] # "roi.rh.f20.f-vs-o.label" "roi.rh.f40.f-vs-o.label"

label_FFA_E1 <- c(label_lFFA_E1, label_rFFA_E1)

The label used for left FFA in Experiment 1 is roi.lh.f20.f-vs-o.label.
The label used for right FFA in Experiment 1 is roi.rh.f20.f-vs-o.label.

# only keep data for these two labels
df_univar_E1_FFA <- filter(df_univar_E1, Label %in% label_FFA_E1) 
df_univar_agg_E1_FFA <- filter(df_univar_agg_E1, Label %in% label_FFA_E1)
df_mvpa_E1_FFA <- filter(df_mvpa_E1, Label %in% label_FFA_E1)
df_mvpa_acc_E1_FFA <- filter(df_mvpa_acc_E1, Label %in% label_FFA_E1)
desc_mvpa_acc_E1_FFA <- filter(desc_mvpa_acc_E1, Label %in% label_FFA_E1)

# subjects used for each hemisphere
# unique(as.character((df_univar_agg_E1_FFA %>% filter(Label == label_rFFA_E1))$SubjCode))

desc_mvpa_acc_E1_FFA %>% 
  select(ExpCode, Label, Count) %>% 
  distinct()

4.2.1.1 Univariate analyses

4.2.1.1.1 rm-ANOVA
4.2.1.1.1.1 Left FFA
anova_E1_lFFA <- aov_4(meanResp ~ FaceWord * Layout + (1 + FaceWord * Layout | SubjCode), 
                      data = filter(df_univar_agg_E1_FFA, Label == label_lFFA_E1))

anova_E1_lFFA
## Anova Table (Type 3 tests)
## 
## Response: meanResp
##            Effect          df  MSE       F  ges p.value
## 1        FaceWord       1, 11 0.19    2.92  .03     .12
## 2          Layout 2.20, 24.17 0.03 7.35 **  .03    .003
## 3 FaceWord:Layout 2.19, 24.14 0.06    0.60 .004     .57
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
## 
## Sphericity correction method: GG
emm_anova_E1_lFFA <- emmeans(anova_E1_lFFA, ~ FaceWord * Layout)

emm_anova_E1_lFFA %>% 
  as.data.frame() %>% 
  arrange(FaceWord)
contrast(emmeans(emm_anova_E1_lFFA, ~ FaceWord), "pairwise")
##  contrast    estimate     SE df t.ratio p.value
##  face - word    0.153 0.0899 11 1.707   0.1158 
## 
## Results are averaged over the levels of: Layout
contrast(emmeans(emm_anova_E1_lFFA, ~ Layout), "pairwise") # , adjust = "none"
##  contrast          estimate     SE df t.ratio p.value
##  intact - exchange   0.0952 0.0462 33  2.061  0.1871 
##  intact - top        0.2145 0.0462 33  4.643  0.0003 
##  intact - bottom     0.0794 0.0462 33  1.720  0.3300 
##  exchange - top      0.1193 0.0462 33  2.583  0.0656 
##  exchange - bottom  -0.0158 0.0462 33 -0.341  0.9861 
##  top - bottom       -0.1350 0.0462 33 -2.924  0.0301 
## 
## Results are averaged over the levels of: FaceWord 
## P value adjustment: tukey method for comparing a family of 4 estimates
contrast(emm_anova_E1_lFFA, "pairwise", simple = "each", combine = TRUE, adjust = "none")
##  Layout   FaceWord contrast          estimate     SE   df t.ratio p.value
##  intact   .        face - word        0.23780 0.1170 27.2  2.033  0.0519 
##  exchange .        face - word        0.17662 0.1170 27.2  1.510  0.1426 
##  top      .        face - word        0.10059 0.1170 27.2  0.860  0.3974 
##  bottom   .        face - word        0.09870 0.1170 27.2  0.844  0.4062 
##  .        face     intact - exchange  0.12577 0.0766 61.4  1.641  0.1059 
##  .        face     intact - top       0.28306 0.0766 61.4  3.693  0.0005 
##  .        face     intact - bottom    0.14897 0.0766 61.4  1.944  0.0565 
##  .        face     exchange - top     0.15729 0.0766 61.4  2.052  0.0444 
##  .        face     exchange - bottom  0.02320 0.0766 61.4  0.303  0.7631 
##  .        face     top - bottom      -0.13409 0.0766 61.4 -1.750  0.0852 
##  .        word     intact - exchange  0.06459 0.0766 61.4  0.843  0.4027 
##  .        word     intact - top       0.14585 0.0766 61.4  1.903  0.0617 
##  .        word     intact - bottom    0.00987 0.0766 61.4  0.129  0.8980 
##  .        word     exchange - top     0.08126 0.0766 61.4  1.060  0.2932 
##  .        word     exchange - bottom -0.05472 0.0766 61.4 -0.714  0.4780 
##  .        word     top - bottom      -0.13598 0.0766 61.4 -1.774  0.0810
# contrast(emm_uni_anova_E1, interaction = "pairwise") # , adjust = "none"
4.2.1.1.1.2 Right FFA
anova_E1_rFFA <- aov_4(meanResp ~ FaceWord * Layout + (1 + FaceWord * Layout | SubjCode), 
                      data = filter(df_univar_agg_E1_FFA, Label == label_rFFA_E1))

anova_E1_rFFA
## Anova Table (Type 3 tests)
## 
## Response: meanResp
##            Effect          df  MSE         F ges p.value
## 1        FaceWord       1, 15 0.28 21.21 *** .12   .0003
## 2          Layout 2.51, 37.67 0.03 10.53 *** .02  <.0001
## 3 FaceWord:Layout 2.12, 31.84 0.06    3.85 * .01     .03
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
## 
## Sphericity correction method: GG
emm_anova_E1_rFFA <- emmeans(anova_E1_rFFA, ~ FaceWord * Layout)

emm_anova_E1_rFFA %>% 
  as.data.frame() %>% 
  arrange(FaceWord)
contrast(emmeans(emm_anova_E1_rFFA, ~ FaceWord), "pairwise")
##  contrast    estimate     SE df t.ratio p.value
##  face - word    0.427 0.0927 15 4.606   0.0003 
## 
## Results are averaged over the levels of: Layout
contrast(emmeans(emm_anova_E1_rFFA, ~ Layout), "pairwise") # , adjust = "none"
##  contrast          estimate     SE df t.ratio p.value
##  intact - exchange   0.1822 0.0402 45  4.529  0.0002 
##  intact - top        0.1980 0.0402 45  4.922  0.0001 
##  intact - bottom     0.1692 0.0402 45  4.206  0.0007 
##  exchange - top      0.0158 0.0402 45  0.393  0.9792 
##  exchange - bottom  -0.0130 0.0402 45 -0.324  0.9881 
##  top - bottom       -0.0288 0.0402 45 -0.716  0.8900 
## 
## Results are averaged over the levels of: FaceWord 
## P value adjustment: tukey method for comparing a family of 4 estimates
contrast(emm_anova_E1_rFFA, "pairwise", simple = "each", combine = TRUE, adjust = "none")
##  Layout   FaceWord contrast          estimate     SE   df t.ratio p.value
##  intact   .        face - word        0.63714 0.1117 29.6  5.702  <.0001 
##  exchange .        face - word        0.34458 0.1117 29.6  3.084  0.0044 
##  top      .        face - word        0.38306 0.1117 29.6  3.428  0.0018 
##  bottom   .        face - word        0.34325 0.1117 29.6  3.072  0.0045 
##  .        face     intact - exchange  0.32852 0.0649 85.4  5.062  <.0001 
##  .        face     intact - top       0.32508 0.0649 85.4  5.009  <.0001 
##  .        face     intact - bottom    0.31616 0.0649 85.4  4.872  <.0001 
##  .        face     exchange - top    -0.00344 0.0649 85.4 -0.053  0.9579 
##  .        face     exchange - bottom -0.01236 0.0649 85.4 -0.190  0.8495 
##  .        face     top - bottom      -0.00892 0.0649 85.4 -0.137  0.8910 
##  .        word     intact - exchange  0.03596 0.0649 85.4  0.554  0.5810 
##  .        word     intact - top       0.07101 0.0649 85.4  1.094  0.2770 
##  .        word     intact - bottom    0.02227 0.0649 85.4  0.343  0.7323 
##  .        word     exchange - top     0.03505 0.0649 85.4  0.540  0.5905 
##  .        word     exchange - bottom -0.01369 0.0649 85.4 -0.211  0.8335 
##  .        word     top - bottom      -0.04874 0.0649 85.4 -0.751  0.4547
# contrast(emm_uni_anova_E1, interaction = "pairwise") # , adjust = "none"
4.2.1.1.2 Plot
# add the column of Hemisphere
nRow_E1 <-nrow(as.data.frame(emm_anova_E1_lFFA))
Hemisphere <- c(rep("left", nRow_E1), rep("right", nRow_E1))
desp_uni_E1_FFA <- cbind(Hemisphere, rbind(as.data.frame(emm_anova_E1_lFFA), as.data.frame(emm_anova_E1_rFFA)))

plot_uni_E1_FFA <- {
  ggplot(data = desp_uni_E1_FFA, aes(y = emmean, x = FaceWord, fill = Layout)) + # set the data, varialbes for x and y axises
    geom_col(position = "dodge", color = "black", alpha = .7) +  # position of columns and countour of columns
    facet_grid(Hemisphere ~ .) +
    geom_errorbar(mapping = aes(ymin = lower.CL, ymax = upper.CL), linetype = 1,  # set the error bar
                  show.legend = FALSE, width = 0.25, alpha = .5,
                  position = position_dodge(width=0.9)) +
    scale_y_continuous(expand= c(0, 0), limits = c(0, activationUL), breaks = seq(0, 3, .5)) +  # remove the space between columns and x axis
    labs(title = "", x = "Stimuli", y = "Beta values") +  # set the names for main, x and y axises Subjective Responses for E205
    general_theme
}

plot_uni_E1_FFA

4.2.1.2 Multivarate analyses (MVPA)

4.2.1.2.1 One-sample t-test
df_mvpa_agg_E1_FFA <- {
  df_mvpa_acc_E1_FFA %>% 
  spread(ClassifyPair, Accuracy) %>% # change to table (each row is one subject)
  select(-c(ExpCode, Label, SubjCode, Count)) # remove these columns
}

df_mvpa_agg_E1_FFA %>% 
  filter(Hemisphere == "left") %>%  
  select(-Hemisphere) %>% 
  sapply(function(x) t.test(x, mu = 0.5, alternative = "greater")) # apply one-sample t-test to each column separately 
##             face_intact-word_intact face_intact-face_exchange
## statistic   5.075047                1.260792                 
## parameter   11                      11                       
## p.value     0.0001788726            0.1167349                
## conf.int    Numeric,2               Numeric,2                
## estimate    0.7                     0.5416667                
## null.value  0.5                     0.5                      
## stderr      0.03940851              0.03304802               
## alternative "greater"               "greater"                
## method      "One Sample t-test"     "One Sample t-test"      
## data.name   "x"                     "x"                      
##             face_top-face_bottom word_intact-word_exchange
## statistic   0.8043997            -0.7956717               
## parameter   11                   11                       
## p.value     0.2191029            0.7784727                
## conf.int    Numeric,2            Numeric,2                
## estimate    0.5333333            0.4666667                
## null.value  0.5                  0.5                      
## stderr      0.04143877           0.04189332               
## alternative "greater"            "greater"                
## method      "One Sample t-test"  "One Sample t-test"      
## data.name   "x"                  "x"                      
##             word_top-word_bottom
## statistic   0.6700594           
## parameter   11                  
## p.value     0.2583198           
## conf.int    Numeric,2           
## estimate    0.5166667           
## null.value  0.5                 
## stderr      0.02487342          
## alternative "greater"           
## method      "One Sample t-test" 
## data.name   "x"
df_mvpa_agg_E1_FFA %>% 
  filter(Hemisphere == "right") %>%  
  select(-Hemisphere) %>% 
  sapply(function(x) t.test(x, mu = 0.5, alternative = "greater")) # apply one-sample t-test to each column separately 
##             face_intact-word_intact face_intact-face_exchange
## statistic   8.380738                2.09687                  
## parameter   15                      15                       
## p.value     2.417307e-07            0.02668428               
## conf.int    Numeric,2               Numeric,2                
## estimate    0.75625                 0.584375                 
## null.value  0.5                     0.5                      
## stderr      0.03057607              0.04023855               
## alternative "greater"               "greater"                
## method      "One Sample t-test"     "One Sample t-test"      
## data.name   "x"                     "x"                      
##             face_top-face_bottom word_intact-word_exchange
## statistic   2.654051             1.013435                 
## parameter   15                   15                       
## p.value     0.009022348          0.1634608                
## conf.int    Numeric,2            Numeric,2                
## estimate    0.603125             0.528125                 
## null.value  0.5                  0.5                      
## stderr      0.0388557            0.02775216               
## alternative "greater"            "greater"                
## method      "One Sample t-test"  "One Sample t-test"      
## data.name   "x"                  "x"                      
##             word_top-word_bottom
## statistic   0.6065043           
## parameter   15                  
## p.value     0.2766246           
## conf.int    Numeric,2           
## estimate    0.51875             
## null.value  0.5                 
## stderr      0.03091487          
## alternative "greater"           
## method      "One Sample t-test" 
## data.name   "x"
4.2.1.2.2 Plot
plot_mvpa_E1_FFA <- {
  ggplot(data = desc_mvpa_acc_E1_FFA, aes(y = emmean, x = ClassifyPair)) + # set the data, varialbes for x and y axises
    geom_col(position = "dodge", color = "black", alpha = .7) +  # position of columns and countour of columns
    facet_grid(Hemisphere ~ .) +
    geom_errorbar(mapping = aes(ymin = lower.CL, ymax = upper.CL), linetype = 1,  # set the error bar
                  show.legend = FALSE, width = 0.25, alpha = .5,
                  position = position_dodge(width=0.9)) +
    geom_hline(yintercept = c(0.5, 1), linetype = 5, alpha = 0.5) +  # add the line for 0.5 and 1 (y)
    scale_y_continuous(expand= c(0, 0), limits = c(0, 1.1), breaks = seq(0, 1, .25)) +  # remove the space between columns and x axis
    scale_x_discrete(labels = function(x) str_wrap(x, width = 10)) + # show x labels in two rows
    labs(title = "", x = "Stimuli", y = "Accuracy") +  # set the names for main, x and y axises Subjective Responses for E205
    geom_text(label = c("***", "", "", "", "", "***", "*", "**", "", ""), color = c(rep("red", 10)), size = 10, nudge_y = 0.15) + # add starts to the significant columns
    general_theme 
  # theme(axis.text.x = element_text(angle = 60, hjust = 1)) +
}

plot_mvpa_E1_FFA

4.2.2 Label:FFA1

# label_lFFA1_E1 <- label_lFFA1[1] # "roi.lh.f13.f-vs-o.ffa1.label" "roi.lh.f20.f-vs-o.ffa1.label"
# label_rFFA1_E1 <- label_rFFA1[1] # "roi.rh.f13.f-vs-o.ffa1.label"

label_FFA1_E1 <- c(label_lFFA1_E1, label_rFFA1_E1)

The label used for left FFA1 in Experiment 1 is roi.lh.f13.f-vs-o.ffa1.label.
The label used for right FFA1 in Experiment 1 is roi.rh.f13.f-vs-o.ffa1.label.

# only keep data for these two labels
df_univar_E1_FFA1 <- filter(df_univar_E1, Label %in% label_FFA1_E1) 
df_univar_agg_E1_FFA1 <- filter(df_univar_agg_E1, Label %in% label_FFA1_E1)
df_mvpa_E1_FFA1 <- filter(df_mvpa_E1, Label %in% label_FFA1_E1)
df_mvpa_acc_E1_FFA1 <- filter(df_mvpa_acc_E1, Label %in% label_FFA1_E1)
desc_mvpa_acc_E1_FFA1 <- filter(desc_mvpa_acc_E1, Label %in% label_FFA1_E1)

# subjects used for each hemisphere
# unique(as.character((df_univar_agg_E1_FFA1 %>% filter(Label == label_rFFA1_E1))$SubjCode))

desc_mvpa_acc_E1_FFA1 %>% 
  select(ExpCode, Label, Count) %>% 
  distinct()

4.2.2.1 Univariate analyses

4.2.2.1.1 rm-ANOVA
4.2.2.1.1.1 Left FFA1
anova_E1_lFFA1 <- aov_4(meanResp ~ FaceWord * Layout + (1 + FaceWord * Layout | SubjCode), 
                      data = filter(df_univar_agg_E1_FFA1, Label == label_lFFA1_E1))

anova_E1_lFFA1
## Anova Table (Type 3 tests)
## 
## Response: meanResp
##            Effect          df  MSE        F ges p.value
## 1        FaceWord       1, 11 0.28   4.52 + .10     .06
## 2          Layout 2.38, 26.17 0.03 9.19 *** .06   .0005
## 3 FaceWord:Layout 2.32, 25.50 0.04     2.07 .02     .14
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
## 
## Sphericity correction method: GG
emm_anova_E1_lFFA1 <- emmeans(anova_E1_lFFA1, ~ FaceWord * Layout)

emm_anova_E1_lFFA1 %>% 
  as.data.frame() %>% 
  arrange(FaceWord)
contrast(emmeans(emm_anova_E1_lFFA1, ~ FaceWord), "pairwise")
##  contrast    estimate    SE df t.ratio p.value
##  face - word    0.229 0.108 11 2.127   0.0569 
## 
## Results are averaged over the levels of: Layout
contrast(emmeans(emm_anova_E1_lFFA1, ~ Layout), "pairwise") # , adjust = "none"
##  contrast          estimate     SE df t.ratio p.value
##  intact - exchange   0.0717 0.0459 33  1.564  0.4127 
##  intact - top        0.2274 0.0459 33  4.958  0.0001 
##  intact - bottom     0.1510 0.0459 33  3.294  0.0120 
##  exchange - top      0.1557 0.0459 33  3.395  0.0093 
##  exchange - bottom   0.0793 0.0459 33  1.730  0.3247 
##  top - bottom       -0.0763 0.0459 33 -1.664  0.3581 
## 
## Results are averaged over the levels of: FaceWord 
## P value adjustment: tukey method for comparing a family of 4 estimates
contrast(emm_anova_E1_lFFA1, "pairwise", simple = "each", combine = TRUE, adjust = "none")
##  Layout   FaceWord contrast          estimate     SE   df t.ratio p.value
##  intact   .        face - word        0.34875 0.1250 19.2  2.789  0.0116 
##  exchange .        face - word        0.15841 0.1250 19.2  1.267  0.2203 
##  top      .        face - word        0.28480 0.1250 19.2  2.278  0.0343 
##  bottom   .        face - word        0.12388 0.1250 19.2  0.991  0.3341 
##  .        face     intact - exchange  0.16687 0.0693 65.0  2.409  0.0189 
##  .        face     intact - top       0.25934 0.0693 65.0  3.743  0.0004 
##  .        face     intact - bottom    0.26348 0.0693 65.0  3.803  0.0003 
##  .        face     exchange - top     0.09247 0.0693 65.0  1.335  0.1866 
##  .        face     exchange - bottom  0.09661 0.0693 65.0  1.394  0.1679 
##  .        face     top - bottom       0.00414 0.0693 65.0  0.060  0.9526 
##  .        word     intact - exchange -0.02347 0.0693 65.0 -0.339  0.7359 
##  .        word     intact - top       0.19540 0.0693 65.0  2.820  0.0064 
##  .        word     intact - bottom    0.03861 0.0693 65.0  0.557  0.5792 
##  .        word     exchange - top     0.21887 0.0693 65.0  3.159  0.0024 
##  .        word     exchange - bottom  0.06208 0.0693 65.0  0.896  0.3735 
##  .        word     top - bottom      -0.15679 0.0693 65.0 -2.263  0.0270
# contrast(emm_uni_anova_E1, interaction = "pairwise") # , adjust = "none"
4.2.2.1.1.2 Right FFA1
anova_E1_rFFA1 <- aov_4(meanResp ~ FaceWord * Layout + (1 + FaceWord * Layout | SubjCode), 
                      data = filter(df_univar_agg_E1_FFA1, Label == label_rFFA1_E1))

anova_E1_rFFA1
## Anova Table (Type 3 tests)
## 
## Response: meanResp
##            Effect          df  MSE         F ges p.value
## 1        FaceWord       1, 15 0.29 24.99 *** .15   .0002
## 2          Layout 2.03, 30.48 0.07    3.20 + .01     .05
## 3 FaceWord:Layout 2.49, 37.37 0.07    3.57 * .01     .03
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
## 
## Sphericity correction method: GG
emm_anova_E1_rFFA1 <- emmeans(anova_E1_rFFA1, ~ FaceWord * Layout)

emm_anova_E1_rFFA1 %>% 
  as.data.frame() %>% 
  arrange(FaceWord)
contrast(emmeans(emm_anova_E1_rFFA1, ~ FaceWord), "pairwise")
##  contrast    estimate     SE df t.ratio p.value
##  face - word    0.473 0.0947 15 4.999   0.0002 
## 
## Results are averaged over the levels of: Layout
contrast(emmeans(emm_anova_E1_rFFA1, ~ Layout), "pairwise") # , adjust = "none"
##  contrast          estimate    SE df t.ratio p.value
##  intact - exchange   0.1333 0.054 45  2.469  0.0788 
##  intact - top        0.1530 0.054 45  2.833  0.0335 
##  intact - bottom     0.0822 0.054 45  1.523  0.4325 
##  exchange - top      0.0197 0.054 45  0.364  0.9833 
##  exchange - bottom  -0.0511 0.054 45 -0.945  0.7806 
##  top - bottom       -0.0707 0.054 45 -1.310  0.5616 
## 
## Results are averaged over the levels of: FaceWord 
## P value adjustment: tukey method for comparing a family of 4 estimates
contrast(emm_anova_E1_rFFA1, "pairwise", simple = "each", combine = TRUE, adjust = "none")
##  Layout   FaceWord contrast          estimate     SE   df t.ratio p.value
##  intact   .        face - word        0.71392 0.1206 35.0  5.921  <.0001 
##  exchange .        face - word        0.39410 0.1206 35.0  3.269  0.0024 
##  top      .        face - word        0.35859 0.1206 35.0  2.974  0.0053 
##  bottom   .        face - word        0.42642 0.1206 35.0  3.537  0.0012 
##  .        face     intact - exchange  0.29321 0.0814 88.7  3.601  0.0005 
##  .        face     intact - top       0.33064 0.0814 88.7  4.060  0.0001 
##  .        face     intact - bottom    0.22600 0.0814 88.7  2.775  0.0067 
##  .        face     exchange - top     0.03743 0.0814 88.7  0.460  0.6469 
##  .        face     exchange - bottom -0.06722 0.0814 88.7 -0.825  0.4113 
##  .        face     top - bottom      -0.10464 0.0814 88.7 -1.285  0.2021 
##  .        word     intact - exchange -0.02661 0.0814 88.7 -0.327  0.7446 
##  .        word     intact - top      -0.02469 0.0814 88.7 -0.303  0.7624 
##  .        word     intact - bottom   -0.06151 0.0814 88.7 -0.755  0.4521 
##  .        word     exchange - top     0.00192 0.0814 88.7  0.024  0.9813 
##  .        word     exchange - bottom -0.03490 0.0814 88.7 -0.429  0.6693 
##  .        word     top - bottom      -0.03681 0.0814 88.7 -0.452  0.6523
# contrast(emm_uni_anova_E1, interaction = "pairwise") # , adjust = "none"
4.2.2.1.2 Plot
# add the column of Hemisphere
nRow_E1 <-nrow(as.data.frame(emm_anova_E1_lFFA1))
Hemisphere <- c(rep("left", nRow_E1), rep("right", nRow_E1))
desp_uni_E1_FFA1 <- cbind(Hemisphere, rbind(as.data.frame(emm_anova_E1_lFFA1), as.data.frame(emm_anova_E1_rFFA1)))

plot_uni_E1_FFA1 <- {
  ggplot(data = desp_uni_E1_FFA1, aes(y = emmean, x = FaceWord, fill = Layout)) + # set the data, varialbes for x and y axises
    geom_col(position = "dodge", color = "black", alpha = .7) +  # position of columns and countour of columns
    facet_grid(Hemisphere ~ .) +
    geom_errorbar(mapping = aes(ymin = lower.CL, ymax = upper.CL), linetype = 1,  # set the error bar
                  show.legend = FALSE, width = 0.25, alpha = .5,
                  position = position_dodge(width=0.9)) +
    scale_y_continuous(expand= c(0, 0), limits = c(0, activationUL), breaks = seq(0, 3, .5)) +  # remove the space between columns and x axis
    labs(title = "", x = "Stimuli", y = "Beta values") +  # set the names for main, x and y axises Subjective Responses for E205
    general_theme
}

plot_uni_E1_FFA1

4.2.2.2 Multivarate analyses (MVPA)

4.2.2.2.1 One-sample t-test
df_mvpa_agg_E1_FFA1 <- {
  df_mvpa_acc_E1_FFA1 %>% 
  spread(ClassifyPair, Accuracy) %>% # change to table (each row is one subject)
  select(-c(ExpCode, Label, SubjCode, Count)) # remove these columns
}

df_mvpa_agg_E1_FFA1 %>% 
  filter(Hemisphere == "left") %>%  
  select(-Hemisphere) %>% 
  sapply(function(x) t.test(x, mu = 0.5, alternative = "greater")) # apply one-sample t-test to each column separately 
##             face_intact-word_intact face_intact-face_exchange
## statistic   5.363636                -1.850199                
## parameter   11                      11                       
## p.value     0.0001144977            0.9543464                
## conf.int    Numeric,2               Numeric,2                
## estimate    0.7458333               0.4375                   
## null.value  0.5                     0.5                      
## stderr      0.04583333              0.03378015               
## alternative "greater"               "greater"                
## method      "One Sample t-test"     "One Sample t-test"      
## data.name   "x"                     "x"                      
##             face_top-face_bottom word_intact-word_exchange
## statistic   2.149866             0.9380832                
## parameter   11                   11                       
## p.value     0.02732986           0.1841713                
## conf.int    Numeric,2            Numeric,2                
## estimate    0.5958333            0.5333333                
## null.value  0.5                  0.5                      
## stderr      0.04457643           0.03553345               
## alternative "greater"            "greater"                
## method      "One Sample t-test"  "One Sample t-test"      
## data.name   "x"                  "x"                      
##             word_top-word_bottom
## statistic   1.017494            
## parameter   11                  
## p.value     0.165388            
## conf.int    Numeric,2           
## estimate    0.5333333           
## null.value  0.5                 
## stderr      0.03276022          
## alternative "greater"           
## method      "One Sample t-test" 
## data.name   "x"
df_mvpa_agg_E1_FFA1 %>% 
  filter(Hemisphere == "right") %>%  
  select(-Hemisphere) %>% 
  sapply(function(x) t.test(x, mu = 0.5, alternative = "greater")) # apply one-sample t-test to each column separately 
##             face_intact-word_intact face_intact-face_exchange
## statistic   7.766196                1.649163                 
## parameter   15                      15                       
## p.value     6.191903e-07            0.05994694               
## conf.int    Numeric,2               Numeric,2                
## estimate    0.790625                0.559375                 
## null.value  0.5                     0.5                      
## stderr      0.03742179              0.03600311               
## alternative "greater"               "greater"                
## method      "One Sample t-test"     "One Sample t-test"      
## data.name   "x"                     "x"                      
##             face_top-face_bottom word_intact-word_exchange
## statistic   2.595799             -1.4                     
## parameter   15                   15                       
## p.value     0.01013387           0.909072                 
## conf.int    Numeric,2            Numeric,2                
## estimate    0.609375             0.45625                  
## null.value  0.5                  0.5                      
## stderr      0.04213538           0.03125                  
## alternative "greater"            "greater"                
## method      "One Sample t-test"  "One Sample t-test"      
## data.name   "x"                  "x"                      
##             word_top-word_bottom
## statistic   1.337227            
## parameter   15                  
## p.value     0.1005372           
## conf.int    Numeric,2           
## estimate    0.534375            
## null.value  0.5                 
## stderr      0.02570617          
## alternative "greater"           
## method      "One Sample t-test" 
## data.name   "x"
4.2.2.2.2 Plot
plot_mvpa_E1_FFA1 <- {
  ggplot(data = desc_mvpa_acc_E1_FFA1, aes(y = emmean, x = ClassifyPair)) + # set the data, varialbes for x and y axises
    geom_col(position = "dodge", color = "black", alpha = .7) +  # position of columns and countour of columns
    facet_grid(Hemisphere ~ .) +
    geom_errorbar(mapping = aes(ymin = lower.CL, ymax = upper.CL), linetype = 1,  # set the error bar
                  show.legend = FALSE, width = 0.25, alpha = .5,
                  position = position_dodge(width=0.9)) +
    geom_hline(yintercept = c(0.5, 1), linetype = 5, alpha = 0.5) +  # add the line for 0.5 and 1 (y)
    scale_y_continuous(expand= c(0, 0), limits = c(0, 1.1), breaks = seq(0, 1, .25)) +  # remove the space between columns and x axis
    scale_x_discrete(labels = function(x) str_wrap(x, width = 10)) + # show x labels in two rows
    labs(title = "", x = "Stimuli", y = "Accuracy") +  # set the names for main, x and y axises Subjective Responses for E205
    geom_text(label = c("***", "", "*", "", "", "***", "*", "*", "", ""), color = c(rep("red", 6), "blue", rep("red", 3)), size = 10, nudge_y = 0.15) + # add starts to the significant columns
    general_theme 
  # theme(axis.text.x = element_text(angle = 60, hjust = 1)) +
}

plot_mvpa_E1_FFA1

4.2.3 Label:FFA2

# label_lFFA2_E1 <- label_lFFA2[1] # "roi.lh.f13.f-vs-o.ffa2.label"
# label_rFFA2_E1 <- label_rFFA2[1] # "roi.rh.f20.f-vs-o.ffa2.label" "roi.rh.f40.f-vs-o.ffa2.label"

label_FFA2_E1 <- c(label_lFFA2_E1, label_rFFA2_E1)

The label used for left FFA2 in Experiment 1 is roi.lh.f13.f-vs-o.ffa2.label.
The label used for right FFA2 in Experiment 1 is roi.rh.f13.f-vs-o.ffa2.label.

# only keep data for these two labels
df_univar_E1_FFA2 <- filter(df_univar_E1, Label %in% label_FFA2_E1) 
df_univar_agg_E1_FFA2 <- filter(df_univar_agg_E1, Label %in% label_FFA2_E1)
df_mvpa_E1_FFA2 <- filter(df_mvpa_E1, Label %in% label_FFA2_E1)
df_mvpa_acc_E1_FFA2 <- filter(df_mvpa_acc_E1, Label %in% label_FFA2_E1)
desc_mvpa_acc_E1_FFA2 <- filter(desc_mvpa_acc_E1, Label %in% label_FFA2_E1)

# subjects used for each hemisphere
# unique(as.character((df_univar_agg_E1_FFA2 %>% filter(Label == label_lFFA2_E1))$SubjCode))

desc_mvpa_acc_E1_FFA2 %>% 
  select(ExpCode, Label, Count) %>% 
  distinct()

4.2.3.1 Univariate analyses

4.2.3.1.1 rm-ANOVA
4.2.3.1.1.1 Left FFA2
anova_E1_lFFA2 <- aov_4(meanResp ~ FaceWord * Layout + (1 + FaceWord * Layout | SubjCode), 
                      data = filter(df_univar_agg_E1_FFA2, Label == label_lFFA2_E1))

anova_E1_lFFA2
## Anova Table (Type 3 tests)
## 
## Response: meanResp
##            Effect          df  MSE       F  ges p.value
## 1        FaceWord       1, 13 0.15    1.20 .010     .29
## 2          Layout 2.18, 28.34 0.03 6.90 **  .02    .003
## 3 FaceWord:Layout 2.65, 34.45 0.05    0.31 .002     .79
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
## 
## Sphericity correction method: GG
emm_anova_E1_lFFA2 <- emmeans(anova_E1_lFFA2, ~ FaceWord * Layout)

emm_anova_E1_lFFA2 %>% 
  as.data.frame() %>% 
  arrange(FaceWord)
contrast(emmeans(emm_anova_E1_lFFA2, ~ FaceWord), "pairwise")
##  contrast    estimate     SE df t.ratio p.value
##  face - word   0.0804 0.0733 13 1.097   0.2925 
## 
## Results are averaged over the levels of: Layout
contrast(emmeans(emm_anova_E1_lFFA2, ~ Layout), "pairwise") # , adjust = "none"
##  contrast          estimate     SE df t.ratio p.value
##  intact - exchange   0.0589 0.0389 39  1.515  0.4387 
##  intact - top        0.1686 0.0389 39  4.336  0.0006 
##  intact - bottom     0.0390 0.0389 39  1.004  0.7479 
##  exchange - top      0.1097 0.0389 39  2.821  0.0361 
##  exchange - bottom  -0.0198 0.0389 39 -0.511  0.9561 
##  top - bottom       -0.1295 0.0389 39 -3.331  0.0098 
## 
## Results are averaged over the levels of: FaceWord 
## P value adjustment: tukey method for comparing a family of 4 estimates
contrast(emm_anova_E1_lFFA2, "pairwise", simple = "each", combine = TRUE, adjust = "none")
##  Layout   FaceWord contrast          estimate     SE   df t.ratio p.value
##  intact   .        face - word        0.13568 0.1005 36.5  1.351  0.1851 
##  exchange .        face - word        0.04621 0.1005 36.5  0.460  0.6482 
##  top      .        face - word        0.09668 0.1005 36.5  0.962  0.3422 
##  bottom   .        face - word        0.04317 0.1005 36.5  0.430  0.6699 
##  .        face     intact - exchange  0.10362 0.0682 69.5  1.519  0.1334 
##  .        face     intact - top       0.18806 0.0682 69.5  2.756  0.0075 
##  .        face     intact - bottom    0.08530 0.0682 69.5  1.250  0.2154 
##  .        face     exchange - top     0.08444 0.0682 69.5  1.238  0.2200 
##  .        face     exchange - bottom -0.01832 0.0682 69.5 -0.269  0.7891 
##  .        face     top - bottom      -0.10276 0.0682 69.5 -1.506  0.1366 
##  .        word     intact - exchange  0.01415 0.0682 69.5  0.207  0.8363 
##  .        word     intact - top       0.14905 0.0682 69.5  2.185  0.0323 
##  .        word     intact - bottom   -0.00722 0.0682 69.5 -0.106  0.9160 
##  .        word     exchange - top     0.13490 0.0682 69.5  1.977  0.0520 
##  .        word     exchange - bottom -0.02137 0.0682 69.5 -0.313  0.7551 
##  .        word     top - bottom      -0.15627 0.0682 69.5 -2.290  0.0250
# contrast(emm_uni_anova_E1, interaction = "pairwise") # , adjust = "none"
4.2.3.1.1.2 Right FFA2
anova_E1_rFFA2 <- aov_4(meanResp ~ FaceWord * Layout + (1 + FaceWord * Layout | SubjCode), 
                      data = filter(df_univar_agg_E1_FFA2, Label == label_rFFA2_E1))

anova_E1_rFFA2
## Anova Table (Type 3 tests)
## 
## Response: meanResp
##            Effect          df  MSE         F  ges p.value
## 1        FaceWord       1, 15 0.12 18.38 ***  .09   .0006
## 2          Layout 2.39, 35.92 0.05   7.30 **  .04    .001
## 3 FaceWord:Layout 2.35, 35.19 0.05      1.89 .009     .16
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
## 
## Sphericity correction method: GG
emm_anova_E1_rFFA2 <- emmeans(anova_E1_rFFA2, ~ FaceWord * Layout)

emm_anova_E1_rFFA2 %>% 
  as.data.frame() %>% 
  arrange(FaceWord)
contrast(emmeans(emm_anova_E1_rFFA2, ~ FaceWord), "pairwise")
##  contrast    estimate     SE df t.ratio p.value
##  face - word    0.263 0.0614 15 4.287   0.0006 
## 
## Results are averaged over the levels of: Layout
contrast(emmeans(emm_anova_E1_rFFA2, ~ Layout), "pairwise") # , adjust = "none"
##  contrast          estimate     SE df t.ratio p.value
##  intact - exchange   0.2036 0.0487 45  4.185  0.0007 
##  intact - top        0.1840 0.0487 45  3.783  0.0025 
##  intact - bottom     0.1597 0.0487 45  3.281  0.0104 
##  exchange - top     -0.0196 0.0487 45 -0.403  0.9777 
##  exchange - bottom  -0.0440 0.0487 45 -0.904  0.8029 
##  top - bottom       -0.0244 0.0487 45 -0.501  0.9584 
## 
## Results are averaged over the levels of: FaceWord 
## P value adjustment: tukey method for comparing a family of 4 estimates
contrast(emm_anova_E1_rFFA2, "pairwise", simple = "each", combine = TRUE, adjust = "none")
##  Layout   FaceWord contrast          estimate     SE   df t.ratio p.value
##  intact   .        face - word        0.39107 0.0847 42.6  4.619  <.0001 
##  exchange .        face - word        0.17920 0.0847 42.6  2.116  0.0402 
##  top      .        face - word        0.26688 0.0847 42.6  3.152  0.0030 
##  bottom   .        face - word        0.21625 0.0847 42.6  2.554  0.0143 
##  .        face     intact - exchange  0.30956 0.0680 90.0  4.549  <.0001 
##  .        face     intact - top       0.24613 0.0680 90.0  3.617  0.0005 
##  .        face     intact - bottom    0.24706 0.0680 90.0  3.631  0.0005 
##  .        face     exchange - top    -0.06343 0.0680 90.0 -0.932  0.3538 
##  .        face     exchange - bottom -0.06250 0.0680 90.0 -0.918  0.3608 
##  .        face     top - bottom       0.00093 0.0680 90.0  0.014  0.9891 
##  .        word     intact - exchange  0.09769 0.0680 90.0  1.436  0.1546 
##  .        word     intact - top       0.12194 0.0680 90.0  1.792  0.0765 
##  .        word     intact - bottom    0.07224 0.0680 90.0  1.062  0.2912 
##  .        word     exchange - top     0.02426 0.0680 90.0  0.356  0.7223 
##  .        word     exchange - bottom -0.02545 0.0680 90.0 -0.374  0.7093 
##  .        word     top - bottom      -0.04970 0.0680 90.0 -0.730  0.4670
# contrast(emm_uni_anova_E1, interaction = "pairwise") # , adjust = "none"
4.2.3.1.2 Plot
# add the column of Hemisphere
nRow_E1 <-nrow(as.data.frame(emm_anova_E1_lFFA2))
Hemisphere <- c(rep("left", nRow_E1), rep("right", nRow_E1))
desp_uni_E1_FFA2 <- cbind(Hemisphere, rbind(as.data.frame(emm_anova_E1_lFFA2), as.data.frame(emm_anova_E1_rFFA2)))

plot_uni_E1_FFA2 <- {
  ggplot(data = desp_uni_E1_FFA2, aes(y = emmean, x = FaceWord, fill = Layout)) + # set the data, varialbes for x and y axises
    geom_col(position = "dodge", color = "black", alpha = .7) +  # position of columns and countour of columns
    facet_grid(Hemisphere ~ .) +
    geom_errorbar(mapping = aes(ymin = lower.CL, ymax = upper.CL), linetype = 1,  # set the error bar
                  show.legend = FALSE, width = 0.25, alpha = .5,
                  position = position_dodge(width=0.9)) +
    scale_y_continuous(expand= c(0, 0), limits = c(0, activationUL), breaks = seq(0, 3, .5)) +  # remove the space between columns and x axis
    labs(title = "", x = "Stimuli", y = "Beta values") +  # set the names for main, x and y axises Subjective Responses for E205
    general_theme
}

plot_uni_E1_FFA2

4.2.3.2 Multivarate analyses (MVPA)

4.2.3.2.1 One-sample t-test
df_mvpa_agg_E1_FFA2 <- {
  df_mvpa_acc_E1_FFA2 %>% 
  spread(ClassifyPair, Accuracy) %>% # change to table (each row is one subject)
  select(-c(ExpCode, Label, SubjCode, Count)) # remove these columns
}

df_mvpa_agg_E1_FFA2 %>% 
  filter(Hemisphere == "left") %>%  
  select(-Hemisphere) %>% 
  sapply(function(x) t.test(x, mu = 0.5, alternative = "greater")) # apply one-sample t-test to each column separately 
##             face_intact-word_intact face_intact-face_exchange
## statistic   6.97137                 1.863439                 
## parameter   13                      13                       
## p.value     4.874809e-06            0.04257117               
## conf.int    Numeric,2               Numeric,2                
## estimate    0.6928571               0.5392857                
## null.value  0.5                     0.5                      
## stderr      0.02766417              0.02108237               
## alternative "greater"               "greater"                
## method      "One Sample t-test"     "One Sample t-test"      
## data.name   "x"                     "x"                      
##             face_top-face_bottom word_intact-word_exchange
## statistic   0.579135             -0.2275804               
## parameter   13                   13                       
## p.value     0.2861985            0.5882437                
## conf.int    Numeric,2            Numeric,2                
## estimate    0.5178571            0.4928571                
## null.value  0.5                  0.5                      
## stderr      0.03083416           0.03138609               
## alternative "greater"            "greater"                
## method      "One Sample t-test"  "One Sample t-test"      
## data.name   "x"                  "x"                      
##             word_top-word_bottom
## statistic   -0.5514468          
## parameter   13                  
## p.value     0.7046598           
## conf.int    Numeric,2           
## estimate    0.4857143           
## null.value  0.5                 
## stderr      0.02590588          
## alternative "greater"           
## method      "One Sample t-test" 
## data.name   "x"
df_mvpa_agg_E1_FFA2 %>% 
  filter(Hemisphere == "right") %>%  
  select(-Hemisphere) %>% 
  sapply(function(x) t.test(x, mu = 0.5, alternative = "greater")) # apply one-sample t-test to each column separately 
##             face_intact-word_intact face_intact-face_exchange
## statistic   8.860142                2.424871                 
## parameter   15                      15                       
## p.value     1.19773e-07             0.014204                 
## conf.int    Numeric,2               Numeric,2                
## estimate    0.690625                0.5875                   
## null.value  0.5                     0.5                      
## stderr      0.02151489              0.03608439               
## alternative "greater"               "greater"                
## method      "One Sample t-test"     "One Sample t-test"      
## data.name   "x"                     "x"                      
##             face_top-face_bottom word_intact-word_exchange
## statistic   1.484542             1.772361                 
## parameter   15                   15                       
## p.value     0.07918746           0.04831956               
## conf.int    Numeric,2            Numeric,2                
## estimate    0.553125             0.540625                 
## null.value  0.5                  0.5                      
## stderr      0.03578546           0.0229214                
## alternative "greater"            "greater"                
## method      "One Sample t-test"  "One Sample t-test"      
## data.name   "x"                  "x"                      
##             word_top-word_bottom
## statistic   1.441153            
## parameter   15                  
## p.value     0.08504544          
## conf.int    Numeric,2           
## estimate    0.5375              
## null.value  0.5                 
## stderr      0.02602082          
## alternative "greater"           
## method      "One Sample t-test" 
## data.name   "x"
4.2.3.2.2 Plot
plot_mvpa_E1_FFA2 <- {
  ggplot(data = desc_mvpa_acc_E1_FFA2, aes(y = emmean, x = ClassifyPair)) + # set the data, varialbes for x and y axises
    geom_col(position = "dodge", color = "black", alpha = .7) +  # position of columns and countour of columns
    facet_grid(Hemisphere ~ .) +
    geom_errorbar(mapping = aes(ymin = lower.CL, ymax = upper.CL), linetype = 1,  # set the error bar
                  show.legend = FALSE, width = 0.25, alpha = .5,
                  position = position_dodge(width=0.9)) +
    geom_hline(yintercept = c(0.5, 1), linetype = 5, alpha = 0.5) +  # add the line for 0.5 and 1 (y)
    scale_y_continuous(expand= c(0, 0), limits = c(0, 1.1), breaks = seq(0, 1, .25)) +  # remove the space between columns and x axis
    scale_x_discrete(labels = function(x) str_wrap(x, width = 10)) + # show x labels in two rows
    labs(title = "", x = "Stimuli", y = "Accuracy") +  # set the names for main, x and y axises Subjective Responses for E205
    geom_text(label = c("***", "*", "", "", "", "***", "**", "*", "*", "*"), color = c(rep("red", 7), "blue", rep("red", 1), "blue"), size = 10, nudge_y = 0.15) + # add starts to the significant columns
    general_theme 
  # theme(axis.text.x = element_text(angle = 60, hjust = 1)) +
}

plot_mvpa_E1_FFA2

4.2.4 Label: left Visual Word Form Area (VWFA)

# label_VWFA_E1 <- label_lVWFA[1] # "roi.lh.f13.w-vs-o.label"

The label used for (left) VWFA in Experiment 1 is roi.lh.f13.w-vs-o.label.

# only keep data for these two labels
df_univar_E1_VWFA <- filter(df_univar_E1, Label %in% label_VWFA_E1) 
df_univar_agg_E1_VWFA <- filter(df_univar_agg_E1, Label %in% label_VWFA_E1)
df_mvpa_E1_VWFA <- filter(df_mvpa_E1, Label %in% label_VWFA_E1)
df_mvpa_acc_E1_VWFA <- filter(df_mvpa_acc_E1, Label %in% label_VWFA_E1)
desc_mvpa_acc_E1_VWFA <- filter(desc_mvpa_acc_E1, Label %in% label_VWFA_E1)

# subjects used for each hemisphere
# unique(as.character((df_univar_agg_E1_VWFA %>% filter(Label == label_VWFA_E1))$SubjCode))

desc_mvpa_acc_E1_VWFA %>% 
  select(ExpCode, Label, Count) %>% 
  distinct()

4.2.4.1 Univariate analyses

4.2.4.1.1 rm-ANOVA
anova_E1_VWFA <- aov_4(meanResp ~ FaceWord * Layout + (1 + FaceWord * Layout | SubjCode), 
                      data = filter(df_univar_agg_E1_VWFA, Label == label_VWFA_E1))

anova_E1_VWFA
## Anova Table (Type 3 tests)
## 
## Response: meanResp
##            Effect          df  MSE         F  ges p.value
## 1        FaceWord       1, 17 0.22 54.76 ***  .15  <.0001
## 2          Layout 2.63, 44.73 0.05    2.65 + .005     .07
## 3 FaceWord:Layout 2.54, 43.17 0.04  9.16 ***  .01   .0002
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
## 
## Sphericity correction method: GG
emm_anova_E1_VWFA <- emmeans(anova_E1_VWFA, ~ FaceWord * Layout)

emm_anova_E1_VWFA %>% 
  as.data.frame() %>% 
  arrange(FaceWord)
contrast(emmeans(emm_anova_E1_VWFA, ~ FaceWord), "pairwise")
##  contrast    estimate     SE df t.ratio p.value
##  face - word   -0.581 0.0785 17 -7.400  <.0001 
## 
## Results are averaged over the levels of: Layout
contrast(emmeans(emm_anova_E1_VWFA, ~ Layout), "pairwise") # , adjust = "none"
##  contrast          estimate     SE df t.ratio p.value
##  intact - exchange   0.0298 0.0494 51  0.604  0.9304 
##  intact - top        0.1305 0.0494 51  2.643  0.0516 
##  intact - bottom     0.0748 0.0494 51  1.514  0.4366 
##  exchange - top      0.1007 0.0494 51  2.039  0.1874 
##  exchange - bottom   0.0450 0.0494 51  0.911  0.7993 
##  top - bottom       -0.0557 0.0494 51 -1.128  0.6739 
## 
## Results are averaged over the levels of: FaceWord 
## P value adjustment: tukey method for comparing a family of 4 estimates
contrast(emm_anova_E1_VWFA, "pairwise", simple = "each", combine = TRUE, adjust = "none")
##  Layout   FaceWord contrast          estimate     SE   df t.ratio p.value
##  intact   .        face - word        -0.4644 0.0929 31.7 -4.999  <.0001 
##  exchange .        face - word        -0.7228 0.0929 31.7 -7.781  <.0001 
##  top      .        face - word        -0.4001 0.0929 31.7 -4.307  0.0001 
##  bottom   .        face - word        -0.7361 0.0929 31.7 -7.923  <.0001 
##  .        face     intact - exchange   0.1590 0.0639 98.3  2.489  0.0145 
##  .        face     intact - top        0.0983 0.0639 98.3  1.539  0.1271 
##  .        face     intact - bottom     0.2106 0.0639 98.3  3.295  0.0014 
##  .        face     exchange - top     -0.0607 0.0639 98.3 -0.950  0.3445 
##  .        face     exchange - bottom   0.0516 0.0639 98.3  0.807  0.4217 
##  .        face     top - bottom        0.1123 0.0639 98.3  1.757  0.0821 
##  .        word     intact - exchange  -0.0994 0.0639 98.3 -1.556  0.1230 
##  .        word     intact - top        0.1626 0.0639 98.3  2.545  0.0125 
##  .        word     intact - bottom    -0.0611 0.0639 98.3 -0.956  0.3415 
##  .        word     exchange - top      0.2620 0.0639 98.3  4.100  0.0001 
##  .        word     exchange - bottom   0.0383 0.0639 98.3  0.600  0.5499 
##  .        word     top - bottom       -0.2237 0.0639 98.3 -3.500  0.0007
# contrast(emm_uni_anova_E1, interaction = "pairwise") # , adjust = "none"
4.2.4.1.2 Plot
plot_uni_E1_VWFA <- {
  ggplot(data = as.data.frame(emm_anova_E1_VWFA), aes(y = emmean, x = FaceWord, fill = Layout)) + # set the data, varialbes for x and y axises
    geom_col(position = "dodge", color = "black", alpha = .7) +  # position of columns and countour of columns
    geom_errorbar(mapping = aes(ymin = lower.CL, ymax = upper.CL), linetype = 1,  # set the error bar
                  show.legend = FALSE, width = 0.25, alpha = .5,
                  position = position_dodge(width=0.9)) +
    scale_y_continuous(expand= c(0, 0), limits = c(0, activationUL), breaks = seq(0, 3, .5)) +  # remove the space between columns and x axis
    labs(title = "", x = "Stimuli", y = "Beta values") +  # set the names for main, x and y axises Subjective Responses for E205
    general_theme
}

plot_uni_E1_VWFA

4.2.4.2 Multivarate analyses (MVPA)

4.2.4.2.1 One-sample t-test
df_mvpa_agg_E1_VWFA <- {
  df_mvpa_acc_E1_VWFA %>% 
  spread(ClassifyPair, Accuracy) %>% # change to table (each row is one subject)
  select(-c(ExpCode, Label, SubjCode, Count)) # remove these columns
}

df_mvpa_agg_E1_VWFA %>% 
  select(-Hemisphere) %>% 
  sapply(function(x) t.test(x, mu = 0.5, alternative = "greater")) # apply one-sample t-test to each column separately 
##             face_intact-word_intact face_intact-face_exchange
## statistic   8.154403                1.810279                 
## parameter   17                      17                       
## p.value     1.40538e-07             0.04398233               
## conf.int    Numeric,2               Numeric,2                
## estimate    0.7055556               0.5666667                
## null.value  0.5                     0.5                      
## stderr      0.02520792              0.03682675               
## alternative "greater"               "greater"                
## method      "One Sample t-test"     "One Sample t-test"      
## data.name   "x"                     "x"                      
##             face_top-face_bottom word_intact-word_exchange
## statistic   0.9790675            1                        
## parameter   17                   17                       
## p.value     0.1706376            0.1656664                
## conf.int    Numeric,2            Numeric,2                
## estimate    0.5388889            0.5361111                
## null.value  0.5                  0.5                      
## stderr      0.03972034           0.03611111               
## alternative "greater"            "greater"                
## method      "One Sample t-test"  "One Sample t-test"      
## data.name   "x"                  "x"                      
##             word_top-word_bottom
## statistic   0.1719454           
## parameter   17                  
## p.value     0.4327554           
## conf.int    Numeric,2           
## estimate    0.5055556           
## null.value  0.5                 
## stderr      0.03231             
## alternative "greater"           
## method      "One Sample t-test" 
## data.name   "x"
4.2.4.2.2 Plot
plot_mvpa_E1_VWFA <- {
  ggplot(data = desc_mvpa_acc_E1_VWFA, aes(y = emmean, x = ClassifyPair)) + # set the data, varialbes for x and y axises
    geom_col(position = "dodge", color = "black", alpha = .7) +  # position of columns and countour of columns
    facet_grid(Hemisphere ~ .) +
    geom_errorbar(mapping = aes(ymin = lower.CL, ymax = upper.CL), linetype = 1,  # set the error bar
                  show.legend = FALSE, width = 0.25, alpha = .5,
                  position = position_dodge(width=0.9)) +
    geom_hline(yintercept = c(0.5, 1), linetype = 5, alpha = 0.5) +  # add the line for 0.5 and 1 (y)
    scale_y_continuous(expand= c(0, 0), limits = c(0, 1.1), breaks = seq(0, 1, .25)) +  # remove the space between columns and x axis
    scale_x_discrete(labels = function(x) str_wrap(x, width = 10)) + # show x labels in two rows
    labs(title = "", x = "Stimuli", y = "Accuracy") +  # set the names for main, x and y axises Subjective Responses for E205
    geom_text(label = c("***", "*", "", "", ""), color = c(rep("red", 5)), size = 10, nudge_y = 0.15) + # add starts to the significant columns
    general_theme 
  # theme(axis.text.x = element_text(angle = 60, hjust = 1)) +
}

plot_mvpa_E1_VWFA

4.2.5 Label:Lateral Occipital Cortex

# label_lLOC_E1 <- label_lLOC[1] # 
# label_rLOC_E1 <- label_rLOC[1] # 

label_LOC_E1 <- c(label_lLOC_E1, label_rLOC_E1)

The label used for left LOC in Experiment 1 is roi.lh.f13.o-vs-scr.label.
The label used for right LOC in Experiment 1 is roi.rh.f13.o-vs-scr.label.

# only keep data for these two labels
df_univar_E1_LOC <- filter(df_univar_E1, Label %in% label_LOC_E1) 
df_univar_agg_E1_LOC <- filter(df_univar_agg_E1, Label %in% label_LOC_E1)
df_mvpa_E1_LOC <- filter(df_mvpa_E1, Label %in% label_LOC_E1)
df_mvpa_acc_E1_LOC <- filter(df_mvpa_acc_E1, Label %in% label_LOC_E1)
desc_mvpa_acc_E1_LOC <- filter(desc_mvpa_acc_E1, Label %in% label_LOC_E1)

# subjects used for each hemisphere
# unique(as.character((df_univar_agg_E1_LOC %>% filter(Label == label_lLOC_E1))$SubjCode))

desc_mvpa_acc_E1_LOC %>% 
  select(ExpCode, Label, Count) %>% 
  distinct()

4.2.5.1 Univariate analyses

4.2.5.1.1 rm-ANOVA
4.2.5.1.1.1 Left LOC
anova_E1_lLOC <- aov_4(meanResp ~ FaceWord * Layout + (1 + FaceWord * Layout | SubjCode), 
                      data = filter(df_univar_agg_E1_LOC, Label == label_lLOC_E1))

anova_E1_lLOC
## Anova Table (Type 3 tests)
## 
## Response: meanResp
##            Effect          df  MSE         F    ges p.value
## 1        FaceWord       1, 18 0.18 21.31 ***    .07   .0002
## 2          Layout 2.10, 37.88 0.05      0.43  .0009     .66
## 3 FaceWord:Layout 2.29, 41.17 0.04      0.03 <.0001     .98
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
## 
## Sphericity correction method: GG
emm_anova_E1_lLOC <- emmeans(anova_E1_lLOC, ~ FaceWord * Layout)

emm_anova_E1_lLOC %>% 
  as.data.frame() %>% 
  arrange(FaceWord)
contrast(emmeans(emm_anova_E1_lLOC, ~ FaceWord), "pairwise")
##  contrast    estimate     SE df t.ratio p.value
##  face - word   -0.317 0.0687 18 -4.616  0.0002 
## 
## Results are averaged over the levels of: Layout
contrast(emmeans(emm_anova_E1_lLOC, ~ Layout), "pairwise") # , adjust = "none"
##  contrast          estimate    SE df t.ratio p.value
##  intact - exchange  0.03553 0.042 54  0.846  0.8323 
##  intact - top       0.04271 0.042 54  1.017  0.7404 
##  intact - bottom    0.03793 0.042 54  0.903  0.8033 
##  exchange - top     0.00718 0.042 54  0.171  0.9982 
##  exchange - bottom  0.00240 0.042 54  0.057  0.9999 
##  top - bottom      -0.00478 0.042 54 -0.114  0.9995 
## 
## Results are averaged over the levels of: FaceWord 
## P value adjustment: tukey method for comparing a family of 4 estimates
contrast(emm_anova_E1_lLOC, "pairwise", simple = "each", combine = TRUE, adjust = "none")
##  Layout   FaceWord contrast          estimate     SE    df t.ratio p.value
##  intact   .        face - word       -0.32384 0.0844  37.7 -3.836  0.0005 
##  exchange .        face - word       -0.30978 0.0844  37.7 -3.669  0.0007 
##  top      .        face - word       -0.30720 0.0844  37.7 -3.639  0.0008 
##  bottom   .        face - word       -0.32860 0.0844  37.7 -3.892  0.0004 
##  .        face     intact - exchange  0.02850 0.0580 107.8  0.491  0.6243 
##  .        face     intact - top       0.03438 0.0580 107.8  0.593  0.5546 
##  .        face     intact - bottom    0.04031 0.0580 107.8  0.695  0.4887 
##  .        face     exchange - top     0.00589 0.0580 107.8  0.101  0.9194 
##  .        face     exchange - bottom  0.01181 0.0580 107.8  0.204  0.8391 
##  .        face     top - bottom       0.00592 0.0580 107.8  0.102  0.9189 
##  .        word     intact - exchange  0.04256 0.0580 107.8  0.734  0.4648 
##  .        word     intact - top       0.05103 0.0580 107.8  0.880  0.3810 
##  .        word     intact - bottom    0.03555 0.0580 107.8  0.613  0.5413 
##  .        word     exchange - top     0.00847 0.0580 107.8  0.146  0.8842 
##  .        word     exchange - bottom -0.00701 0.0580 107.8 -0.121  0.9040 
##  .        word     top - bottom      -0.01548 0.0580 107.8 -0.267  0.7901
# contrast(emm_uni_anova_E1, interaction = "pairwise") # , adjust = "none"
4.2.5.1.1.2 Right LOC
anova_E1_rLOC <- aov_4(meanResp ~ FaceWord * Layout + (1 + FaceWord * Layout | SubjCode), 
                      data = filter(df_univar_agg_E1_LOC, Label == label_rLOC_E1))

anova_E1_rLOC
## Anova Table (Type 3 tests)
## 
## Response: meanResp
##            Effect          df  MSE      F   ges p.value
## 1        FaceWord       1, 16 0.25 3.70 +   .01     .07
## 2          Layout 2.26, 36.17 0.08   0.71  .002     .52
## 3 FaceWord:Layout 2.40, 38.42 0.05   0.41 .0006     .71
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
## 
## Sphericity correction method: GG
emm_anova_E1_rLOC <- emmeans(anova_E1_rLOC, ~ FaceWord * Layout)

emm_anova_E1_rLOC %>% 
  as.data.frame() %>% 
  arrange(FaceWord)
contrast(emmeans(emm_anova_E1_rLOC, ~ FaceWord), "pairwise")
##  contrast    estimate     SE df t.ratio p.value
##  face - word   -0.166 0.0861 16 -1.923  0.0725 
## 
## Results are averaged over the levels of: Layout
contrast(emmeans(emm_anova_E1_rLOC, ~ Layout), "pairwise") # , adjust = "none"
##  contrast           estimate     SE df t.ratio p.value
##  intact - exchange  0.082239 0.0595 48  1.381  0.5172 
##  intact - top       0.060637 0.0595 48  1.018  0.7396 
##  intact - bottom    0.060014 0.0595 48  1.008  0.7456 
##  exchange - top    -0.021602 0.0595 48 -0.363  0.9835 
##  exchange - bottom -0.022225 0.0595 48 -0.373  0.9821 
##  top - bottom      -0.000623 0.0595 48 -0.010  1.0000 
## 
## Results are averaged over the levels of: FaceWord 
## P value adjustment: tukey method for comparing a family of 4 estimates
contrast(emm_anova_E1_rLOC, "pairwise", simple = "each", combine = TRUE, adjust = "none")
##  Layout   FaceWord contrast          estimate     SE   df t.ratio p.value
##  intact   .        face - word       -0.11262 0.1039 31.7 -1.084  0.2867 
##  exchange .        face - word       -0.21399 0.1039 31.7 -2.059  0.0478 
##  top      .        face - word       -0.15496 0.1039 31.7 -1.491  0.1458 
##  bottom   .        face - word       -0.18075 0.1039 31.7 -1.739  0.0917 
##  .        face     intact - exchange  0.13293 0.0762 91.5  1.745  0.0843 
##  .        face     intact - top       0.08181 0.0762 91.5  1.074  0.2856 
##  .        face     intact - bottom    0.09408 0.0762 91.5  1.235  0.2199 
##  .        face     exchange - top    -0.05112 0.0762 91.5 -0.671  0.5038 
##  .        face     exchange - bottom -0.03885 0.0762 91.5 -0.510  0.6112 
##  .        face     top - bottom       0.01227 0.0762 91.5  0.161  0.8724 
##  .        word     intact - exchange  0.03155 0.0762 91.5  0.414  0.6797 
##  .        word     intact - top       0.03946 0.0762 91.5  0.518  0.6056 
##  .        word     intact - bottom    0.02595 0.0762 91.5  0.341  0.7341 
##  .        word     exchange - top     0.00791 0.0762 91.5  0.104  0.9175 
##  .        word     exchange - bottom -0.00560 0.0762 91.5 -0.074  0.9415 
##  .        word     top - bottom      -0.01351 0.0762 91.5 -0.177  0.8596
# contrast(emm_uni_anova_E1, interaction = "pairwise") # , adjust = "none"
4.2.5.1.2 Plot
# add the column of Hemisphere
nRow_E1 <-nrow(as.data.frame(emm_anova_E1_lLOC))
Hemisphere <- c(rep("left", nRow_E1), rep("right", nRow_E1))
desp_uni_E1_LOC <- cbind(Hemisphere, rbind(as.data.frame(emm_anova_E1_lLOC), as.data.frame(emm_anova_E1_rLOC)))

plot_uni_E1_LOC <- {
  ggplot(data = desp_uni_E1_LOC, aes(y = emmean, x = FaceWord, fill = Layout)) + # set the data, varialbes for x and y axises
    geom_col(position = "dodge", color = "black", alpha = .7) +  # position of columns and countour of columns
    facet_grid(Hemisphere ~ .) +
    geom_errorbar(mapping = aes(ymin = lower.CL, ymax = upper.CL), linetype = 1,  # set the error bar
                  show.legend = FALSE, width = 0.25, alpha = .5,
                  position = position_dodge(width=0.9)) +
    scale_y_continuous(expand= c(0, 0), limits = c(0, activationUL), breaks = seq(0, 3, .5)) +  # remove the space between columns and x axis
    labs(title = "", x = "Stimuli", y = "Beta values") +  # set the names for main, x and y axises Subjective Responses for E205
    general_theme
}

plot_uni_E1_LOC

4.2.5.2 Multivarate analyses (MVPA)

4.2.5.2.1 One-sample t-test
df_mvpa_agg_E1_LOC <- {
  df_mvpa_acc_E1_LOC %>% 
  spread(ClassifyPair, Accuracy) %>% # change to table (each row is one subject)
  select(-c(ExpCode, Label, SubjCode, Count)) # remove these columns
}

df_mvpa_agg_E1_LOC %>% 
  filter(Hemisphere == "left") %>%  
  select(-Hemisphere) %>% 
  sapply(function(x) t.test(x, mu = 0.5, alternative = "greater")) # apply one-sample t-test to each column separately 
##             face_intact-word_intact face_intact-face_exchange
## statistic   6.179459                2.117647                 
## parameter   18                      18                       
## p.value     3.910056e-06            0.02419283               
## conf.int    Numeric,2               Numeric,2                
## estimate    0.7605263               0.5631579                
## null.value  0.5                     0.5                      
## stderr      0.04216005              0.02982456               
## alternative "greater"               "greater"                
## method      "One Sample t-test"     "One Sample t-test"      
## data.name   "x"                     "x"                      
##             face_top-face_bottom word_intact-word_exchange
## statistic   3.225275             3.067192                 
## parameter   18                   18                       
## p.value     0.00234707           0.003319323              
## conf.int    Numeric,2            Numeric,2                
## estimate    0.6184211            0.5789474                
## null.value  0.5                  0.5                      
## stderr      0.03671658           0.0257393                
## alternative "greater"            "greater"                
## method      "One Sample t-test"  "One Sample t-test"      
## data.name   "x"                  "x"                      
##             word_top-word_bottom
## statistic   3.05279             
## parameter   18                  
## p.value     0.003425313         
## conf.int    Numeric,2           
## estimate    0.5921053           
## null.value  0.5                 
## stderr      0.03017085          
## alternative "greater"           
## method      "One Sample t-test" 
## data.name   "x"
df_mvpa_agg_E1_LOC %>% 
  filter(Hemisphere == "right") %>%  
  select(-Hemisphere) %>% 
  sapply(function(x) t.test(x, mu = 0.5, alternative = "greater")) # apply one-sample t-test to each column separately 
##             face_intact-word_intact face_intact-face_exchange
## statistic   6.830721                1.576527                 
## parameter   16                      16                       
## p.value     2.019522e-06            0.06723427               
## conf.int    Numeric,2               Numeric,2                
## estimate    0.7764706               0.5470588                
## null.value  0.5                     0.5                      
## stderr      0.04047459              0.02984968               
## alternative "greater"               "greater"                
## method      "One Sample t-test"     "One Sample t-test"      
## data.name   "x"                     "x"                      
##             face_top-face_bottom word_intact-word_exchange
## statistic   3.997233             3.771236                 
## parameter   16                   16                       
## p.value     0.0005190233         0.0008355743             
## conf.int    Numeric,2            Numeric,2                
## estimate    0.6117647            0.5705882                
## null.value  0.5                  0.5                      
## stderr      0.02796052           0.01871753               
## alternative "greater"            "greater"                
## method      "One Sample t-test"  "One Sample t-test"      
## data.name   "x"                  "x"                      
##             word_top-word_bottom
## statistic   3.570283            
## parameter   16                  
## p.value     0.001277334         
## conf.int    Numeric,2           
## estimate    0.6205882           
## null.value  0.5                 
## stderr      0.03377554          
## alternative "greater"           
## method      "One Sample t-test" 
## data.name   "x"
4.2.5.2.2 Plot
plot_mvpa_E1_LOC <- {
  ggplot(data = desc_mvpa_acc_E1_LOC, aes(y = emmean, x = ClassifyPair)) + # set the data, varialbes for x and y axises
    geom_col(position = "dodge", color = "black", alpha = .7) +  # position of columns and countour of columns
    facet_grid(Hemisphere ~ .) +
    geom_errorbar(mapping = aes(ymin = lower.CL, ymax = upper.CL), linetype = 1,  # set the error bar
                  show.legend = FALSE, width = 0.25, alpha = .5,
                  position = position_dodge(width=0.9)) +
    geom_hline(yintercept = c(0.5, 1), linetype = 5, alpha = 0.5) +  # add the line for 0.5 and 1 (y)
    scale_y_continuous(expand= c(0, 0), limits = c(0, 1.1), breaks = seq(0, 1, .25)) +  # remove the space between columns and x axis
    scale_x_discrete(labels = function(x) str_wrap(x, width = 10)) + # show x labels in two rows
    labs(title = "", x = "Stimuli", y = "Accuracy") +  # set the names for main, x and y axises Subjective Responses for E205
    geom_text(label = c("***", "*", "**", "**", "**", "***", "*", "***", "***", "**"), color = c(rep("red", 6), "blue", rep("red", 3)), size = 10, nudge_y = 0.15) + # add starts to the significant columns
    general_theme 
  # theme(axis.text.x = element_text(angle = 60, hjust = 1)) +
}

plot_mvpa_E1_LOC

5 Experiment 2: Chinese and English

5.1 localizer (Univariate analyses)

df_loc_E2 <- {
  df_clean_loc %>% 
    filter(ExpCode == 2) %>% 
    mutate(SubjCode = as.factor(SubjCode))
}
# nlevels(df_loc_E2$SubjCode) # number of subjects

5.1.1 rm-ANOVA

anova_loc_E2 <- aov_4(Resp ~ Conditions + (Conditions | SubjCode), data = df_loc_E2)

anova_loc_E2
## Anova Table (Type 3 tests)
## 
## Response: Resp
##       Effect          df  MSE          F ges p.value
## 1 Conditions 2.31, 41.62 0.04 174.98 *** .60  <.0001
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
## 
## Sphericity correction method: GG
emm_loc_anova_E2 <- emmeans(anova_loc_E2, ~ Conditions)

emm_loc_anova_E2
##  Conditions emmean     SE   df lower.CL upper.CL
##  face        1.545 0.0909 24.8    1.358    1.732
##  object      0.779 0.0909 24.8    0.592    0.967
##  word        0.318 0.0909 24.8    0.131    0.505
##  scrambled   0.499 0.0909 24.8    0.311    0.686
## 
## Warning: EMMs are biased unless design is perfectly balanced 
## Confidence level used: 0.95
contrast(emm_loc_anova_E2, "pairwise")
##  contrast           estimate     SE df t.ratio p.value
##  face - object         0.766 0.0578 54 13.238  <.0001 
##  face - word           1.227 0.0578 54 21.218  <.0001 
##  face - scrambled      1.046 0.0578 54 18.093  <.0001 
##  object - word         0.461 0.0578 54  7.980  <.0001 
##  object - scrambled    0.281 0.0578 54  4.855  0.0001 
##  word - scrambled     -0.181 0.0578 54 -3.125  0.0147 
## 
## P value adjustment: tukey method for comparing a family of 4 estimates

5.1.2 Linear mixed model

lmm_loc_E2 <- lmer(Resp ~ Conditions + (1 | SubjCode), data = df_loc_E2)

summary(lmm_loc_E2)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: Resp ~ Conditions + (1 | SubjCode)
##    Data: df_loc_E2
## 
## REML criterion at convergence: 18.5
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -1.79802 -0.44250 -0.05595  0.43601  2.03820 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  SubjCode (Intercept) 0.12514  0.3537  
##  Residual             0.03177  0.1782  
## Number of obs: 76, groups:  SubjCode, 19
## 
## Fixed effects:
##                     Estimate Std. Error       df t value Pr(>|t|)    
## (Intercept)          1.54488    0.09088 24.75836   17.00 3.67e-15 ***
## Conditionsobject    -0.76558    0.05783 54.00000  -13.24  < 2e-16 ***
## Conditionsword      -1.22706    0.05783 54.00000  -21.22  < 2e-16 ***
## Conditionsscrambled -1.04633    0.05783 54.00000  -18.09  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) Cndtnsb Cndtnsw
## Condtnsbjct -0.318                
## Conditnswrd -0.318  0.500         
## Cndtnsscrmb -0.318  0.500   0.500
emm_loc_lmm_E2 <- emmeans(lmm_loc_E2, ~ Conditions)

emm_loc_lmm_E2
##  Conditions emmean     SE   df lower.CL upper.CL
##  face        1.545 0.0909 24.8    1.358    1.732
##  object      0.779 0.0909 24.8    0.592    0.967
##  word        0.318 0.0909 24.8    0.131    0.505
##  scrambled   0.499 0.0909 24.8    0.311    0.686
## 
## Degrees-of-freedom method: kenward-roger 
## Confidence level used: 0.95
contrast(emm_loc_lmm_E2, "pairwise")
##  contrast           estimate     SE df t.ratio p.value
##  face - object         0.766 0.0578 54 13.238  <.0001 
##  face - word           1.227 0.0578 54 21.218  <.0001 
##  face - scrambled      1.046 0.0578 54 18.093  <.0001 
##  object - word         0.461 0.0578 54  7.980  <.0001 
##  object - scrambled    0.281 0.0578 54  4.855  0.0001 
##  word - scrambled     -0.181 0.0578 54 -3.125  0.0147 
## 
## Degrees-of-freedom method: kenward-roger 
## P value adjustment: tukey method for comparing a family of 4 estimates

5.1.3 Plot

plot_loc_E2 <- {
  ggplot(data = as.data.frame(emm_loc_anova_E2), aes(y = emmean, x = Conditions)) + # set the data, varialbes for x and y axises
    geom_col(position = "dodge", color = "black", alpha = .7) +  # position of columns and countour of columns
    geom_errorbar(mapping = aes(ymin = lower.CL, ymax = upper.CL), linetype = 1,  # set the error bar
                  show.legend = FALSE, width = 0.25, alpha = .5,
                  position = position_dodge(width=0.9)) +
    scale_y_continuous(expand= c(0, 0), limits = c(0, activationUL), breaks = seq(0, 3, .5)) +  # remove the space between columns and x axis
    labs(title = "", x = "Stimuli", y = "Neural Responses") +  # set the names for main, x and y axises Subjective Responses for E205
    general_theme
}

plot_loc_E2

5.2 Main runs

# only keep data of E2
df_univar_E2 <- {
  df_clean_univar %>% 
    filter(ExpCode == 2) %>% 
    mutate(FaceWord = factor(FaceWord, levels = wordsOrder),
           SubjCode = as.factor(SubjCode))
}

df_univar_agg_E2 <- {
  df_univar_agg %>% 
    filter(ExpCode == 2) %>% 
    mutate(FaceWord = factor(FaceWord, levels = wordsOrder),
           SubjCode = as.factor(SubjCode))
}
# only keep data of E2
df_mvpa_E2 <- {
  df_clean_mvpa %>% 
    filter(ExpCode == 2) %>% 
    mutate(ClassifyPair = factor(ClassifyPair, levels = pairOrder_E2),
           SubjCode = as.factor(SubjCode))
}

df_mvpa_acc_E2 <- {
  df_mvpa_acc %>% 
    filter(ExpCode == 2) %>% 
    mutate(ClassifyPair = factor(ClassifyPair, levels = pairOrder_E2),
           SubjCode = as.factor(SubjCode))
}

desc_mvpa_acc_E2 <- {
  desc_mvpa_acc %>% 
    filter(ExpCode == 2) %>% 
    mutate(ClassifyPair = factor(ClassifyPair, levels = pairOrder_E2)) %>% 
    arrange(ExpCode, Hemisphere, Label, ClassifyPair)
}

5.2.1 Label:FFA

# label_lFFA_E2 <- label_lFFA[1] # "roi.lh.f20.f-vs-o.label" "roi.lh.f40.f-vs-o.label"
# label_rFFA_E2 <- label_rFFA[1] # "roi.rh.f20.f-vs-o.label" "roi.rh.f40.f-vs-o.label"

label_FFA_E2 <- c(label_lFFA_E2, label_rFFA_E2)

The label used for left FFA in Experiment 2 is roi.lh.f20.f-vs-o.label.
The label used for right FFA in Experiment 2 is roi.rh.f20.f-vs-o.label.

# only keep data for these two labels
df_univar_E2_FFA <- filter(df_univar_E2, Label %in% label_FFA_E2) 
df_univar_agg_E2_FFA <- filter(df_univar_agg_E2, Label %in% label_FFA_E2)
df_mvpa_E2_FFA <- filter(df_mvpa_E2, Label %in% label_FFA_E2)
df_mvpa_acc_E2_FFA <- filter(df_mvpa_acc_E2, Label %in% label_FFA_E2)
desc_mvpa_acc_E2_FFA <- filter(desc_mvpa_acc_E2, Label %in% label_FFA_E2)

# subjects used for each hemisphere
# unique(as.character((df_univar_agg_E2_FFA %>% filter(Label == label_lFFA_E2))$SubjCode))

desc_mvpa_acc_E2_FFA %>% 
  select(ExpCode, Label, Count) %>% 
  distinct()

5.2.1.1 Univariate analyses

5.2.1.1.1 rm-ANOVA
5.2.1.1.1.1 Left FFA
anova_E2_lFFA <- aov_4(meanResp ~ FaceWord * Layout + (1 + FaceWord * Layout | SubjCode), 
                      data = filter(df_univar_agg_E2_FFA, Label == label_lFFA_E2))

anova_E2_lFFA
## Anova Table (Type 3 tests)
## 
## Response: meanResp
##            Effect          df  MSE        F  ges p.value
## 1        FaceWord       1, 13 0.18 11.15 **  .12    .005
## 2          Layout 2.57, 33.43 0.02     0.53 .001     .64
## 3 FaceWord:Layout 2.67, 34.66 0.03   3.48 *  .02     .03
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
## 
## Sphericity correction method: GG
emm_anova_E2_lFFA <- emmeans(anova_E2_lFFA, ~ FaceWord * Layout)

emm_anova_E2_lFFA %>% 
  as.data.frame() %>% 
  arrange(FaceWord)
contrast(emmeans(emm_anova_E2_lFFA, ~ FaceWord), "pairwise")
##  contrast          estimate     SE df t.ratio p.value
##  Chinese - English    -0.27 0.0808 13 -3.339  0.0053 
## 
## Results are averaged over the levels of: Layout
contrast(emmeans(emm_anova_E2_lFFA, ~ Layout), "pairwise") # , adjust = "none"
##  contrast          estimate    SE df t.ratio p.value
##  intact - exchange  0.02718 0.031 39  0.877  0.8164 
##  intact - top       0.03179 0.031 39  1.026  0.7351 
##  intact - bottom    0.00439 0.031 39  0.142  0.9990 
##  exchange - top     0.00461 0.031 39  0.149  0.9988 
##  exchange - bottom -0.02279 0.031 39 -0.736  0.8821 
##  top - bottom      -0.02740 0.031 39 -0.885  0.8128 
## 
## Results are averaged over the levels of: FaceWord 
## P value adjustment: tukey method for comparing a family of 4 estimates
contrast(emm_anova_E2_lFFA, "pairwise", simple = "each", combine = TRUE, adjust = "none")
##  Layout   FaceWord contrast          estimate     SE   df t.ratio p.value
##  intact   .        Chinese - English -0.34958 0.0956 24.2 -3.655  0.0012 
##  exchange .        Chinese - English -0.27322 0.0956 24.2 -2.857  0.0086 
##  top      .        Chinese - English -0.11262 0.0956 24.2 -1.178  0.2504 
##  bottom   .        Chinese - English -0.34340 0.0956 24.2 -3.591  0.0015 
##  .        Chinese  intact - exchange -0.01100 0.0520 71.9 -0.211  0.8332 
##  .        Chinese  intact - top      -0.08669 0.0520 71.9 -1.666  0.1000 
##  .        Chinese  intact - bottom    0.00130 0.0520 71.9  0.025  0.9801 
##  .        Chinese  exchange - top    -0.07569 0.0520 71.9 -1.455  0.1501 
##  .        Chinese  exchange - bottom  0.01230 0.0520 71.9  0.236  0.8137 
##  .        Chinese  top - bottom       0.08799 0.0520 71.9  1.691  0.0951 
##  .        English  intact - exchange  0.06535 0.0520 71.9  1.256  0.2132 
##  .        English  intact - top       0.15027 0.0520 71.9  2.888  0.0051 
##  .        English  intact - bottom    0.00748 0.0520 71.9  0.144  0.8862 
##  .        English  exchange - top     0.08491 0.0520 71.9  1.632  0.1071 
##  .        English  exchange - bottom -0.05788 0.0520 71.9 -1.112  0.2697 
##  .        English  top - bottom      -0.14279 0.0520 71.9 -2.744  0.0077
# contrast(emm_uni_anova_E2, interaction = "pairwise") # , adjust = "none"
5.2.1.1.1.2 Right FFA
anova_E2_rFFA <- aov_4(meanResp ~ FaceWord * Layout + (1 + FaceWord * Layout | SubjCode), 
                      data = filter(df_univar_agg_E2_FFA, Label == label_rFFA_E2))

anova_E2_rFFA
## Anova Table (Type 3 tests)
## 
## Response: meanResp
##            Effect          df  MSE    F  ges p.value
## 1        FaceWord       1, 17 0.06 0.40 .003     .54
## 2          Layout 2.54, 43.11 0.02 2.20  .01     .11
## 3 FaceWord:Layout 2.48, 42.09 0.02 1.08 .006     .36
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
## 
## Sphericity correction method: GG
emm_anova_E2_rFFA <- emmeans(anova_E2_rFFA, ~ FaceWord * Layout)

emm_anova_E2_rFFA %>% 
  as.data.frame() %>% 
  arrange(FaceWord)
contrast(emmeans(emm_anova_E2_rFFA, ~ FaceWord), "pairwise")
##  contrast          estimate     SE df t.ratio p.value
##  Chinese - English   0.0266 0.0423 17 0.630   0.5370 
## 
## Results are averaged over the levels of: Layout
contrast(emmeans(emm_anova_E2_rFFA, ~ Layout), "pairwise") # , adjust = "none"
##  contrast          estimate     SE df t.ratio p.value
##  intact - exchange  0.04620 0.0303 51  1.525  0.4305 
##  intact - top      -0.01834 0.0303 51 -0.605  0.9299 
##  intact - bottom    0.04243 0.0303 51  1.400  0.5049 
##  exchange - top    -0.06454 0.0303 51 -2.130  0.1574 
##  exchange - bottom -0.00376 0.0303 51 -0.124  0.9993 
##  top - bottom       0.06078 0.0303 51  2.006  0.1993 
## 
## Results are averaged over the levels of: FaceWord 
## P value adjustment: tukey method for comparing a family of 4 estimates
contrast(emm_anova_E2_rFFA, "pairwise", simple = "each", combine = TRUE, adjust = "none")
##  Layout   FaceWord contrast          estimate     SE    df t.ratio p.value
##  intact   .        Chinese - English -0.01811 0.0564  44.9 -0.321  0.7497 
##  exchange .        Chinese - English  0.06380 0.0564  44.9  1.131  0.2642 
##  top      .        Chinese - English  0.06656 0.0564  44.9  1.180  0.2444 
##  bottom   .        Chinese - English -0.00571 0.0564  44.9 -0.101  0.9198 
##  .        Chinese  intact - exchange  0.00524 0.0430 102.0  0.122  0.9033 
##  .        Chinese  intact - top      -0.06068 0.0430 102.0 -1.411  0.1613 
##  .        Chinese  intact - bottom    0.03623 0.0430 102.0  0.842  0.4015 
##  .        Chinese  exchange - top    -0.06592 0.0430 102.0 -1.533  0.1284 
##  .        Chinese  exchange - bottom  0.03099 0.0430 102.0  0.721  0.4728 
##  .        Chinese  top - bottom       0.09691 0.0430 102.0  2.253  0.0264 
##  .        English  intact - exchange  0.08715 0.0430 102.0  2.026  0.0453 
##  .        English  intact - top       0.02399 0.0430 102.0  0.558  0.5782 
##  .        English  intact - bottom    0.04863 0.0430 102.0  1.131  0.2608 
##  .        English  exchange - top    -0.06316 0.0430 102.0 -1.469  0.1450 
##  .        English  exchange - bottom -0.03852 0.0430 102.0 -0.896  0.3725 
##  .        English  top - bottom       0.02464 0.0430 102.0  0.573  0.5679
# contrast(emm_uni_anova_E2, interaction = "pairwise") # , adjust = "none"
5.2.1.1.2 Plot
# add the column of Hemisphere
nRow_E2 <-nrow(as.data.frame(emm_anova_E2_lFFA))
Hemisphere <- c(rep("left", nRow_E2), rep("right", nRow_E2))
desp_uni_E2_FFA <- cbind(Hemisphere, rbind(as.data.frame(emm_anova_E2_lFFA), as.data.frame(emm_anova_E2_rFFA)))

plot_uni_E2_FFA <- {
  ggplot(data = desp_uni_E2_FFA, aes(y = emmean, x = FaceWord, fill = Layout)) + # set the data, varialbes for x and y axises
    geom_col(position = "dodge", color = "black", alpha = .7) +  # position of columns and countour of columns
    facet_grid(Hemisphere ~ .) +
    geom_errorbar(mapping = aes(ymin = lower.CL, ymax = upper.CL), linetype = 1,  # set the error bar
                  show.legend = FALSE, width = 0.25, alpha = .5,
                  position = position_dodge(width=0.9)) +
    scale_y_continuous(expand= c(0, 0), limits = c(-0.2, activationUL), breaks = seq(0, 3, .5)) +  # remove the space between columns and x axis
    labs(title = "", x = "Stimuli", y = "Beta values") +  # set the names for main, x and y axises Subjective Responses for E205
    general_theme
}

plot_uni_E2_FFA

5.2.1.2 Multivarate analyses (MVPA)

5.2.1.2.1 One-sample t-test
df_mvpa_agg_E2_FFA <- {
  df_mvpa_acc_E2_FFA %>% 
  spread(ClassifyPair, Accuracy) %>% # change to table (each row is one subject)
  select(-c(ExpCode, Label, SubjCode, Count)) # remove these columns
}

df_mvpa_agg_E2_FFA %>% 
  filter(Hemisphere == "left") %>%  
  select(-Hemisphere) %>% 
  sapply(function(x) t.test(x, mu = 0.5, alternative = "greater")) # apply one-sample t-test to each column separately 
##             Chinese_intact-English_intact Chinese_intact-Chinese_exchange
## statistic   1.946903                      -1.301041                      
## parameter   13                            13                             
## p.value     0.03674012                    0.8920837                      
## conf.int    Numeric,2                     Numeric,2                      
## estimate    0.6142857                     0.4642857                      
## null.value  0.5                           0.5                            
## stderr      0.05870128                    0.02745054                     
## alternative "greater"                     "greater"                      
## method      "One Sample t-test"           "One Sample t-test"            
## data.name   "x"                           "x"                            
##             Chinese_top-Chinese_bottom English_intact-English_exchange
## statistic   -0.4653196                 1.908194                       
## parameter   13                         13                             
## p.value     0.6752993                  0.0393476                      
## conf.int    Numeric,2                  Numeric,2                      
## estimate    0.4821429                  0.5785714                      
## null.value  0.5                        0.5                            
## stderr      0.03837608                 0.04117581                     
## alternative "greater"                  "greater"                      
## method      "One Sample t-test"        "One Sample t-test"            
## data.name   "x"                        "x"                            
##             English_top-English_bottom
## statistic   2.869727                  
## parameter   13                        
## p.value     0.006575002               
## conf.int    Numeric,2                 
## estimate    0.6107143                 
## null.value  0.5                       
## stderr      0.03858008                
## alternative "greater"                 
## method      "One Sample t-test"       
## data.name   "x"
df_mvpa_agg_E2_FFA %>% 
  filter(Hemisphere == "right") %>%  
  select(-Hemisphere) %>% 
  sapply(function(x) t.test(x, mu = 0.5, alternative = "greater")) # apply one-sample t-test to each column separately 
##             Chinese_intact-English_intact Chinese_intact-Chinese_exchange
## statistic   4.099221                      0.6807151                      
## parameter   17                            17                             
## p.value     0.0003739893                  0.2526092                      
## conf.int    Numeric,2                     Numeric,2                      
## estimate    0.6027778                     0.5222222                      
## null.value  0.5                           0.5                            
## stderr      0.02507252                    0.03264541                     
## alternative "greater"                     "greater"                      
## method      "One Sample t-test"           "One Sample t-test"            
## data.name   "x"                           "x"                            
##             Chinese_top-Chinese_bottom English_intact-English_exchange
## statistic   0.6420064                  1.426006                       
## parameter   17                         17                             
## p.value     0.264716                   0.08598601                     
## conf.int    Numeric,2                  Numeric,2                      
## estimate    0.5194444                  0.5416667                      
## null.value  0.5                        0.5                            
## stderr      0.030287                   0.02921914                     
## alternative "greater"                  "greater"                      
## method      "One Sample t-test"        "One Sample t-test"            
## data.name   "x"                        "x"                            
##             English_top-English_bottom
## statistic   2.346316                  
## parameter   17                        
## p.value     0.01567053                
## conf.int    Numeric,2                 
## estimate    0.5805556                 
## null.value  0.5                       
## stderr      0.03433278                
## alternative "greater"                 
## method      "One Sample t-test"       
## data.name   "x"
5.2.1.2.2 Plot
plot_mvpa_E2_FFA <- {
  ggplot(data = desc_mvpa_acc_E2_FFA, aes(y = emmean, x = ClassifyPair)) + # set the data, varialbes for x and y axises
    geom_col(position = "dodge", color = "black", alpha = .7) +  # position of columns and countour of columns
    facet_grid(Hemisphere ~ .) +
    geom_errorbar(mapping = aes(ymin = lower.CL, ymax = upper.CL), linetype = 1,  # set the error bar
                  show.legend = FALSE, width = 0.25, alpha = .5,
                  position = position_dodge(width=0.9)) +
    geom_hline(yintercept = c(0.5, 1), linetype = 5, alpha = 0.5) +  # add the line for 0.5 and 1 (y)
    scale_y_continuous(expand= c(0, 0), limits = c(0, 1.1), breaks = seq(0, 1, .25)) +  # remove the space between columns and x axis
    scale_x_discrete(labels = function(x) str_wrap(x, width = 10)) + # show x labels in two rows
    labs(title = "", x = "Stimuli", y = "Accuracy") +  # set the names for main, x and y axises Subjective Responses for E205
    geom_text(label = c("*", "", "", "*", "**", "***", "", "", "*", "*"), color = c(rep("red", 8), rep("blue", 1), "red"), size = 10, nudge_y = 0.15) + # add starts to the significant columns
    general_theme 
  # theme(axis.text.x = element_text(angle = 60, hjust = 1)) +
}

plot_mvpa_E2_FFA

5.2.2 Label:FFA1

# label_lFFA1_E2 <- label_lFFA1[1] # "roi.lh.f13.f-vs-o.ffa1.label" "roi.lh.f20.f-vs-o.ffa1.label"
# label_rFFA1_E2 <- label_rFFA1[1] # "roi.rh.f13.f-vs-o.ffa1.label"

label_FFA1_E2 <- c(label_lFFA1_E2, label_rFFA1_E2)

The label used for left FFA1 in Experiment 2 is roi.lh.f13.f-vs-o.ffa1.label.
The label used for right FFA1 in Experiment 2 is roi.rh.f13.f-vs-o.ffa1.label.

# only keep data for these two labels
df_univar_E2_FFA1 <- filter(df_univar_E2, Label %in% label_FFA1_E2) 
df_univar_agg_E2_FFA1 <- filter(df_univar_agg_E2, Label %in% label_FFA1_E2)
df_mvpa_E2_FFA1 <- filter(df_mvpa_E2, Label %in% label_FFA1_E2)
df_mvpa_acc_E2_FFA1 <- filter(df_mvpa_acc_E2, Label %in% label_FFA1_E2)
desc_mvpa_acc_E2_FFA1 <- filter(desc_mvpa_acc_E2, Label %in% label_FFA1_E2)

# subjects used for each hemisphere
# unique(as.character((df_univar_agg_E2_FFA1 %>% filter(Label == label_rFFA1_E2))$SubjCode))

desc_mvpa_acc_E2_FFA1 %>% 
  select(ExpCode, Label, Count) %>% 
  distinct()

5.2.2.1 Univariate analyses

5.2.2.1.1 rm-ANOVA
5.2.2.1.1.1 Left FFA1
anova_E2_lFFA1 <- aov_4(meanResp ~ FaceWord * Layout + (1 + FaceWord * Layout | SubjCode), 
                      data = filter(df_univar_agg_E2_FFA1, Label == label_lFFA1_E2))

anova_E2_lFFA1
## Anova Table (Type 3 tests)
## 
## Response: meanResp
##            Effect          df  MSE        F ges p.value
## 1        FaceWord       1, 10 0.17 12.43 ** .09    .005
## 2          Layout 2.00, 20.05 0.04   3.40 + .01     .05
## 3 FaceWord:Layout 2.06, 20.61 0.04  6.09 ** .02    .008
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
## 
## Sphericity correction method: GG
emm_anova_E2_lFFA1 <- emmeans(anova_E2_lFFA1, ~ FaceWord * Layout)

emm_anova_E2_lFFA1 %>% 
  as.data.frame() %>% 
  arrange(FaceWord)
contrast(emmeans(emm_anova_E2_lFFA1, ~ FaceWord), "pairwise")
##  contrast          estimate     SE df t.ratio p.value
##  Chinese - English    -0.31 0.0878 10 -3.525  0.0055 
## 
## Results are averaged over the levels of: Layout
contrast(emmeans(emm_anova_E2_lFFA1, ~ Layout), "pairwise") # , adjust = "none"
##  contrast          estimate     SE df t.ratio p.value
##  intact - exchange -0.13120 0.0465 30 -2.822  0.0396 
##  intact - top      -0.00867 0.0465 30 -0.187  0.9976 
##  intact - bottom   -0.06443 0.0465 30 -1.386  0.5175 
##  exchange - top     0.12252 0.0465 30  2.636  0.0601 
##  exchange - bottom  0.06676 0.0465 30  1.436  0.4874 
##  top - bottom      -0.05576 0.0465 30 -1.199  0.6319 
## 
## Results are averaged over the levels of: FaceWord 
## P value adjustment: tukey method for comparing a family of 4 estimates
contrast(emm_anova_E2_lFFA1, "pairwise", simple = "each", combine = TRUE, adjust = "none")
##  Layout   FaceWord contrast          estimate     SE   df t.ratio p.value
##  intact   .        Chinese - English  -0.3362 0.1087 21.4 -3.093  0.0054 
##  exchange .        Chinese - English  -0.4461 0.1087 21.4 -4.104  0.0005 
##  top      .        Chinese - English  -0.0449 0.1087 21.4 -0.413  0.6835 
##  bottom   .        Chinese - English  -0.4116 0.1087 21.4 -3.787  0.0011 
##  .        Chinese  intact - exchange  -0.0762 0.0699 59.2 -1.090  0.2803 
##  .        Chinese  intact - top       -0.1543 0.0699 59.2 -2.206  0.0313 
##  .        Chinese  intact - bottom    -0.0267 0.0699 59.2 -0.382  0.7041 
##  .        Chinese  exchange - top     -0.0781 0.0699 59.2 -1.116  0.2689 
##  .        Chinese  exchange - bottom   0.0495 0.0699 59.2  0.708  0.4817 
##  .        Chinese  top - bottom        0.1276 0.0699 59.2  1.824  0.0732 
##  .        English  intact - exchange  -0.1862 0.0699 59.2 -2.662  0.0100 
##  .        English  intact - top        0.1369 0.0699 59.2  1.958  0.0550 
##  .        English  intact - bottom    -0.1022 0.0699 59.2 -1.461  0.1494 
##  .        English  exchange - top      0.3231 0.0699 59.2  4.619  <.0001 
##  .        English  exchange - bottom   0.0840 0.0699 59.2  1.201  0.2346 
##  .        English  top - bottom       -0.2391 0.0699 59.2 -3.418  0.0011
# contrast(emm_uni_anova_E2, interaction = "pairwise") # , adjust = "none"
5.2.2.1.1.2 Right FFA1
anova_E2_rFFA1 <- aov_4(meanResp ~ FaceWord * Layout + (1 + FaceWord * Layout | SubjCode), 
                      data = filter(df_univar_agg_E2_FFA1, Label == label_rFFA1_E2))

anova_E2_rFFA1
## Anova Table (Type 3 tests)
## 
## Response: meanResp
##            Effect          df  MSE    F  ges p.value
## 1        FaceWord       1, 15 0.14 1.03 .006     .33
## 2          Layout 2.65, 39.71 0.04 1.25 .005     .30
## 3 FaceWord:Layout 2.45, 36.71 0.03 1.40 .004     .26
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
## 
## Sphericity correction method: GG
emm_anova_E2_rFFA1 <- emmeans(anova_E2_rFFA1, ~ FaceWord * Layout)

emm_anova_E2_rFFA1 %>% 
  as.data.frame() %>% 
  arrange(FaceWord)
contrast(emmeans(emm_anova_E2_rFFA1, ~ FaceWord), "pairwise")
##  contrast          estimate     SE df t.ratio p.value
##  Chinese - English   0.0665 0.0654 15 1.017   0.3253 
## 
## Results are averaged over the levels of: Layout
contrast(emmeans(emm_anova_E2_rFFA1, ~ Layout), "pairwise") # , adjust = "none"
##  contrast          estimate     SE df t.ratio p.value
##  intact - exchange   0.0376 0.0462 45  0.814  0.8476 
##  intact - top       -0.0480 0.0462 45 -1.038  0.7283 
##  intact - bottom     0.0173 0.0462 45  0.374  0.9819 
##  exchange - top     -0.0856 0.0462 45 -1.852  0.2633 
##  exchange - bottom  -0.0203 0.0462 45 -0.440  0.9713 
##  top - bottom        0.0653 0.0462 45  1.412  0.4986 
## 
## Results are averaged over the levels of: FaceWord 
## P value adjustment: tukey method for comparing a family of 4 estimates
contrast(emm_anova_E2_rFFA1, "pairwise", simple = "each", combine = TRUE, adjust = "none")
##  Layout   FaceWord contrast          estimate     SE   df t.ratio p.value
##  intact   .        Chinese - English  0.04533 0.0809 32.1  0.560  0.5793 
##  exchange .        Chinese - English  0.13991 0.0809 32.1  1.729  0.0935 
##  top      .        Chinese - English  0.09311 0.0809 32.1  1.150  0.2584 
##  bottom   .        Chinese - English -0.01220 0.0809 32.1 -0.151  0.8811 
##  .        Chinese  intact - exchange -0.00966 0.0604 87.4 -0.160  0.8733 
##  .        Chinese  intact - top      -0.07188 0.0604 87.4 -1.190  0.2374 
##  .        Chinese  intact - bottom    0.04607 0.0604 87.4  0.762  0.4479 
##  .        Chinese  exchange - top    -0.06221 0.0604 87.4 -1.030  0.3060 
##  .        Chinese  exchange - bottom  0.05573 0.0604 87.4  0.922  0.3589 
##  .        Chinese  top - bottom       0.11794 0.0604 87.4  1.952  0.0541 
##  .        English  intact - exchange  0.08492 0.0604 87.4  1.405  0.1634 
##  .        English  intact - top      -0.02409 0.0604 87.4 -0.399  0.6911 
##  .        English  intact - bottom   -0.01146 0.0604 87.4 -0.190  0.8501 
##  .        English  exchange - top    -0.10901 0.0604 87.4 -1.804  0.0747 
##  .        English  exchange - bottom -0.09637 0.0604 87.4 -1.595  0.1143 
##  .        English  top - bottom       0.01263 0.0604 87.4  0.209  0.8349
# contrast(emm_uni_anova_E2, interaction = "pairwise") # , adjust = "none"
5.2.2.1.2 Plot
# add the column of Hemisphere
nRow_E2 <-nrow(as.data.frame(emm_anova_E2_lFFA1))
Hemisphere <- c(rep("left", nRow_E2), rep("right", nRow_E2))
desp_uni_E2_FFA1 <- cbind(Hemisphere, rbind(as.data.frame(emm_anova_E2_lFFA1), as.data.frame(emm_anova_E2_rFFA1)))

plot_uni_E2_FFA1 <- {
  ggplot(data = desp_uni_E2_FFA1, aes(y = emmean, x = FaceWord, fill = Layout)) + # set the data, varialbes for x and y axises
    geom_col(position = "dodge", color = "black", alpha = .7) +  # position of columns and countour of columns
    facet_grid(Hemisphere ~ .) +
    geom_errorbar(mapping = aes(ymin = lower.CL, ymax = upper.CL), linetype = 1,  # set the error bar
                  show.legend = FALSE, width = 0.25, alpha = .5,
                  position = position_dodge(width=0.9)) +
    scale_y_continuous(expand= c(0, 0), limits = c(0, activationUL), breaks = seq(0, 3, .5)) +  # remove the space between columns and x axis
    labs(title = "", x = "Stimuli", y = "Beta values") +  # set the names for main, x and y axises Subjective Responses for E205
    general_theme
}

plot_uni_E2_FFA1

5.2.2.2 Multivarate analyses (MVPA)

5.2.2.2.1 One-sample t-test
df_mvpa_agg_E2_FFA1 <- {
  df_mvpa_acc_E2_FFA1 %>% 
  spread(ClassifyPair, Accuracy) %>% # change to table (each row is one subject)
  select(-c(ExpCode, Label, SubjCode, Count)) # remove these columns
}

df_mvpa_agg_E2_FFA1 %>% 
  filter(Hemisphere == "left") %>%  
  select(-Hemisphere) %>% 
  sapply(function(x) t.test(x, mu = 0.5, alternative = "greater")) # apply one-sample t-test to each column separately 
##             Chinese_intact-English_intact Chinese_intact-Chinese_exchange
## statistic   5.220926                      0.5816751                      
## parameter   10                            10                             
## p.value     0.000194677                   0.2868316                      
## conf.int    Numeric,2                     Numeric,2                      
## estimate    0.7363636                     0.5136364                      
## null.value  0.5                           0.5                            
## stderr      0.04527236                    0.02344327                     
## alternative "greater"                     "greater"                      
## method      "One Sample t-test"           "One Sample t-test"            
## data.name   "x"                           "x"                            
##             Chinese_top-Chinese_bottom English_intact-English_exchange
## statistic   0.8061435                  0.2110531                      
## parameter   10                         10                             
## p.value     0.2194551                  0.4185423                      
## conf.int    Numeric,2                  Numeric,2                      
## estimate    0.5318182                  0.5090909                      
## null.value  0.5                        0.5                            
## stderr      0.03946962                 0.04307403                     
## alternative "greater"                  "greater"                      
## method      "One Sample t-test"        "One Sample t-test"            
## data.name   "x"                        "x"                            
##             English_top-English_bottom
## statistic   1.431366                  
## parameter   10                        
## p.value     0.09141355                
## conf.int    Numeric,2                 
## estimate    0.5863636                 
## null.value  0.5                       
## stderr      0.06033652                
## alternative "greater"                 
## method      "One Sample t-test"       
## data.name   "x"
df_mvpa_agg_E2_FFA1 %>% 
  filter(Hemisphere == "right") %>%  
  select(-Hemisphere) %>% 
  sapply(function(x) t.test(x, mu = 0.5, alternative = "greater")) # apply one-sample t-test to each column separately 
##             Chinese_intact-English_intact Chinese_intact-Chinese_exchange
## statistic   4.553754                      0.5129892                      
## parameter   15                            15                             
## p.value     0.0001901737                  0.3077153                      
## conf.int    Numeric,2                     Numeric,2                      
## estimate    0.63125                       0.5125                         
## null.value  0.5                           0.5                            
## stderr      0.02882237                    0.02436699                     
## alternative "greater"                     "greater"                      
## method      "One Sample t-test"           "One Sample t-test"            
## data.name   "x"                           "x"                            
##             Chinese_top-Chinese_bottom English_intact-English_exchange
## statistic   2.015044                   0.3934041                      
## parameter   15                         15                             
## p.value     0.03109298                 0.3497781                      
## conf.int    Numeric,2                  Numeric,2                      
## estimate    0.56875                    0.515625                       
## null.value  0.5                        0.5                            
## stderr      0.03411836                 0.03971743                     
## alternative "greater"                  "greater"                      
## method      "One Sample t-test"        "One Sample t-test"            
## data.name   "x"                        "x"                            
##             English_top-English_bottom
## statistic   1.300054                  
## parameter   15                        
## p.value     0.1066026                 
## conf.int    Numeric,2                 
## estimate    0.55                      
## null.value  0.5                       
## stderr      0.03845994                
## alternative "greater"                 
## method      "One Sample t-test"       
## data.name   "x"
5.2.2.2.2 Plot
plot_mvpa_E2_FFA1 <- {
  ggplot(data = desc_mvpa_acc_E2_FFA1, aes(y = emmean, x = ClassifyPair)) + # set the data, varialbes for x and y axises
    geom_col(position = "dodge", color = "black", alpha = .7) +  # position of columns and countour of columns
    facet_grid(Hemisphere ~ .) +
    geom_errorbar(mapping = aes(ymin = lower.CL, ymax = upper.CL), linetype = 1,  # set the error bar
                  show.legend = FALSE, width = 0.25, alpha = .5,
                  position = position_dodge(width=0.9)) +
    geom_hline(yintercept = c(0.5, 1), linetype = 5, alpha = 0.5) +  # add the line for 0.5 and 1 (y)
    scale_y_continuous(expand= c(0, 0), limits = c(0, 1.1), breaks = seq(0, 1, .25)) +  # remove the space between columns and x axis
    scale_x_discrete(labels = function(x) str_wrap(x, width = 10)) + # show x labels in two rows
    labs(title = "", x = "Stimuli", y = "Accuracy") +  # set the names for main, x and y axises Subjective Responses for E205
    geom_text(label = c("**", "", "", "", "*", "***", "", "*", "", ""), color = c(rep("red", 4), "blue", rep("red", 5)), size = 10, nudge_y = 0.15) + # add starts to the significant columns
    general_theme 
  # theme(axis.text.x = element_text(angle = 60, hjust = 1)) +
}

plot_mvpa_E2_FFA1

5.2.3 Label:FFA2

# label_lFFA2_E2 <- label_lFFA2[1] # "roi.lh.f13.f-vs-o.ffa2.label"
# label_rFFA2_E2 <- label_rFFA2[1] # "roi.rh.f20.f-vs-o.ffa2.label" "roi.rh.f40.f-vs-o.ffa2.label"

label_FFA2_E2 <- c(label_lFFA2_E2, label_rFFA2_E2)

The label used for left FFA2 in Experiment 1 is roi.lh.f13.f-vs-o.ffa2.label.
The label used for right FFA2 in Experiment 1 is roi.rh.f13.f-vs-o.ffa2.label.

# only keep data for these two labels
df_univar_E2_FFA2 <- filter(df_univar_E2, Label %in% label_FFA2_E2) 
df_univar_agg_E2_FFA2 <- filter(df_univar_agg_E2, Label %in% label_FFA2_E2)
df_mvpa_E2_FFA2 <- filter(df_mvpa_E2, Label %in% label_FFA2_E2)
df_mvpa_acc_E2_FFA2 <- filter(df_mvpa_acc_E2, Label %in% label_FFA2_E2)
desc_mvpa_acc_E2_FFA2 <- filter(desc_mvpa_acc_E2, Label %in% label_FFA2_E2)

# subjects used for each hemisphere
unique(as.character((df_univar_agg_E2_FFA2 %>% filter(Label == label_rFFA2_E2))$SubjCode))
##  [1] "facewordN01_self" "facewordN02_self" "facewordN03_self"
##  [4] "facewordN05_self" "facewordN06_self" "facewordN07_self"
##  [7] "facewordN08_self" "facewordN09_self" "facewordN10_self"
## [10] "facewordN11_self" "facewordN12_self" "facewordN13_self"
## [13] "facewordN14_self" "facewordN15_self" "facewordN16_self"
## [16] "facewordN17_self" "facewordN18_self" "facewordN19_self"
## [19] "facewordN20_self"
desc_mvpa_acc_E2_FFA2 %>% 
  select(ExpCode, Label, Count) %>% 
  distinct()

5.2.3.1 Univariate analyses

5.2.3.1.1 rm-ANOVA
5.2.3.1.1.1 Left FFA2
anova_E2_lFFA2 <- aov_4(meanResp ~ FaceWord * Layout + (1 + FaceWord * Layout | SubjCode), 
                      data = filter(df_univar_agg_E2_FFA2, Label == label_lFFA2_E2))

anova_E2_lFFA2
## Anova Table (Type 3 tests)
## 
## Response: meanResp
##            Effect          df  MSE        F  ges p.value
## 1        FaceWord       1, 13 0.11 11.43 **  .08    .005
## 2          Layout 2.87, 37.35 0.02     0.86 .003     .47
## 3 FaceWord:Layout 2.83, 36.84 0.02   2.63 +  .01     .07
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
## 
## Sphericity correction method: GG
emm_anova_E2_lFFA2 <- emmeans(anova_E2_lFFA2, ~ FaceWord * Layout)

emm_anova_E2_lFFA2 %>% 
  as.data.frame() %>% 
  arrange(FaceWord)
contrast(emmeans(emm_anova_E2_lFFA2, ~ FaceWord), "pairwise")
##  contrast          estimate     SE df t.ratio p.value
##  Chinese - English   -0.215 0.0635 13 -3.381  0.0049 
## 
## Results are averaged over the levels of: Layout
contrast(emmeans(emm_anova_E2_lFFA2, ~ Layout), "pairwise") # , adjust = "none"
##  contrast          estimate     SE df t.ratio p.value
##  intact - exchange  0.02176 0.0333 39  0.653  0.9138 
##  intact - top       0.04288 0.0333 39  1.287  0.5763 
##  intact - bottom   -0.00452 0.0333 39 -0.136  0.9991 
##  exchange - top     0.02112 0.0333 39  0.634  0.9203 
##  exchange - bottom -0.02628 0.0333 39 -0.789  0.8590 
##  top - bottom      -0.04740 0.0333 39 -1.423  0.4929 
## 
## Results are averaged over the levels of: FaceWord 
## P value adjustment: tukey method for comparing a family of 4 estimates
contrast(emm_anova_E2_lFFA2, "pairwise", simple = "each", combine = TRUE, adjust = "none")
##  Layout   FaceWord contrast          estimate     SE   df t.ratio p.value
##  intact   .        Chinese - English -0.28796 0.0805 30.0 -3.575  0.0012 
##  exchange .        Chinese - English -0.24848 0.0805 30.0 -3.085  0.0044 
##  top      .        Chinese - English -0.07867 0.0805 30.0 -0.977  0.3365 
##  bottom   .        Chinese - English -0.24349 0.0805 30.0 -3.023  0.0051 
##  .        Chinese  intact - exchange  0.00201 0.0524 75.2  0.038  0.9695 
##  .        Chinese  intact - top      -0.06177 0.0524 75.2 -1.179  0.2423 
##  .        Chinese  intact - bottom   -0.02675 0.0524 75.2 -0.511  0.6112 
##  .        Chinese  exchange - top    -0.06378 0.0524 75.2 -1.217  0.2274 
##  .        Chinese  exchange - bottom -0.02877 0.0524 75.2 -0.549  0.5847 
##  .        Chinese  top - bottom       0.03501 0.0524 75.2  0.668  0.5061 
##  .        English  intact - exchange  0.04150 0.0524 75.2  0.792  0.4309 
##  .        English  intact - top       0.14752 0.0524 75.2  2.815  0.0062 
##  .        English  intact - bottom    0.01771 0.0524 75.2  0.338  0.7363 
##  .        English  exchange - top     0.10603 0.0524 75.2  2.023  0.0466 
##  .        English  exchange - bottom -0.02378 0.0524 75.2 -0.454  0.6513 
##  .        English  top - bottom      -0.12981 0.0524 75.2 -2.477  0.0155
# contrast(emm_uni_anova_E2, interaction = "pairwise") # , adjust = "none"
5.2.3.1.1.2 Right FFA2
anova_E2_rFFA2 <- aov_4(meanResp ~ FaceWord * Layout + (1 + FaceWord * Layout | SubjCode), 
                      data = filter(df_univar_agg_E2_FFA2, Label == label_rFFA2_E2))

anova_E2_rFFA2
## Anova Table (Type 3 tests)
## 
## Response: meanResp
##            Effect          df  MSE    F  ges p.value
## 1        FaceWord       1, 18 0.04 0.27 .002     .61
## 2          Layout 2.91, 52.37 0.01 0.70 .005     .55
## 3 FaceWord:Layout 2.40, 43.27 0.02 0.56 .005     .60
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
## 
## Sphericity correction method: GG
emm_anova_E2_rFFA2 <- emmeans(anova_E2_rFFA2, ~ FaceWord * Layout)

emm_anova_E2_rFFA2 %>% 
  as.data.frame() %>% 
  arrange(FaceWord)
contrast(emmeans(emm_anova_E2_rFFA2, ~ FaceWord), "pairwise")
##  contrast          estimate     SE df t.ratio p.value
##  Chinese - English   0.0177 0.0344 18 0.516   0.6123 
## 
## Results are averaged over the levels of: Layout
contrast(emmeans(emm_anova_E2_rFFA2, ~ Layout), "pairwise") # , adjust = "none"
##  contrast          estimate     SE df t.ratio p.value
##  intact - exchange  0.03019 0.0267 54  1.130  0.6730 
##  intact - top      -0.00560 0.0267 54 -0.210  0.9967 
##  intact - bottom    0.00504 0.0267 54  0.189  0.9976 
##  exchange - top    -0.03579 0.0267 54 -1.339  0.5425 
##  exchange - bottom -0.02515 0.0267 54 -0.941  0.7830 
##  top - bottom       0.01064 0.0267 54  0.398  0.9784 
## 
## Results are averaged over the levels of: FaceWord 
## P value adjustment: tukey method for comparing a family of 4 estimates
contrast(emm_anova_E2_rFFA2, "pairwise", simple = "each", combine = TRUE, adjust = "none")
##  Layout   FaceWord contrast          estimate     SE    df t.ratio p.value
##  intact   .        Chinese - English -0.01588 0.0500  56.8 -0.318  0.7517 
##  exchange .        Chinese - English  0.02486 0.0500  56.8  0.498  0.6206 
##  top      .        Chinese - English  0.05773 0.0500  56.8  1.156  0.2527 
##  bottom   .        Chinese - English  0.00425 0.0500  56.8  0.085  0.9325 
##  .        Chinese  intact - exchange  0.00982 0.0399 106.9  0.246  0.8060 
##  .        Chinese  intact - top      -0.04241 0.0399 106.9 -1.064  0.2899 
##  .        Chinese  intact - bottom   -0.00502 0.0399 106.9 -0.126  0.9000 
##  .        Chinese  exchange - top    -0.05223 0.0399 106.9 -1.310  0.1931 
##  .        Chinese  exchange - bottom -0.01484 0.0399 106.9 -0.372  0.7105 
##  .        Chinese  top - bottom       0.03738 0.0399 106.9  0.938  0.3505 
##  .        English  intact - exchange  0.05056 0.0399 106.9  1.268  0.2075 
##  .        English  intact - top       0.03121 0.0399 106.9  0.783  0.4355 
##  .        English  intact - bottom    0.01511 0.0399 106.9  0.379  0.7055 
##  .        English  exchange - top    -0.01936 0.0399 106.9 -0.485  0.6284 
##  .        English  exchange - bottom -0.03546 0.0399 106.9 -0.889  0.3759 
##  .        English  top - bottom      -0.01610 0.0399 106.9 -0.404  0.6872
# contrast(emm_uni_anova_E2, interaction = "pairwise") # , adjust = "none"
5.2.3.1.2 Plot
# add the column of Hemisphere
nRow_E2 <-nrow(as.data.frame(emm_anova_E2_lFFA2))
Hemisphere <- c(rep("left", nRow_E2), rep("right", nRow_E2))
desp_uni_E2_FFA2 <- cbind(Hemisphere, rbind(as.data.frame(emm_anova_E2_lFFA2), as.data.frame(emm_anova_E2_rFFA2)))

plot_uni_E2_FFA2 <- {
  ggplot(data = desp_uni_E2_FFA2, aes(y = emmean, x = FaceWord, fill = Layout)) + # set the data, varialbes for x and y axises
    geom_col(position = "dodge", color = "black", alpha = .7) +  # position of columns and countour of columns
    facet_grid(Hemisphere ~ .) +
    geom_errorbar(mapping = aes(ymin = lower.CL, ymax = upper.CL), linetype = 1,  # set the error bar
                  show.legend = FALSE, width = 0.25, alpha = .5,
                  position = position_dodge(width=0.9)) +
    scale_y_continuous(expand= c(0, 0), limits = c(-0.1, activationUL), breaks = seq(0, 3, .5)) +  # remove the space between columns and x axis
    labs(title = "", x = "Stimuli", y = "Beta values") +  # set the names for main, x and y axises Subjective Responses for E205
    general_theme
}

plot_uni_E2_FFA2

5.2.3.2 Multivarate analyses (MVPA)

5.2.3.2.1 One-sample t-test
df_mvpa_agg_E2_FFA2 <- {
  df_mvpa_acc_E2_FFA2 %>% 
  spread(ClassifyPair, Accuracy) %>% # change to table (each row is one subject)
  select(-c(ExpCode, Label, SubjCode, Count)) # remove these columns
}

df_mvpa_agg_E2_FFA2 %>% 
  filter(Hemisphere == "left") %>%  
  select(-Hemisphere) %>% 
  sapply(function(x) t.test(x, mu = 0.5, alternative = "greater")) # apply one-sample t-test to each column separately 
##             Chinese_intact-English_intact Chinese_intact-Chinese_exchange
## statistic   2.86258                       -0.3446472                     
## parameter   13                            13                             
## p.value     0.006665747                   0.6320643                      
## conf.int    Numeric,2                     Numeric,2                      
## estimate    0.6392857                     0.4892857                      
## null.value  0.5                           0.5                            
## stderr      0.04865741                    0.03108769                     
## alternative "greater"                     "greater"                      
## method      "One Sample t-test"           "One Sample t-test"            
## data.name   "x"                           "x"                            
##             Chinese_top-Chinese_bottom English_intact-English_exchange
## statistic   -0.2914915                 1.253872                       
## parameter   13                         13                             
## p.value     0.6123627                  0.1159841                      
## conf.int    Numeric,2                  Numeric,2                      
## estimate    0.4892857                  0.5678571                      
## null.value  0.5                        0.5                            
## stderr      0.03675676                 0.05411809                     
## alternative "greater"                  "greater"                      
## method      "One Sample t-test"        "One Sample t-test"            
## data.name   "x"                        "x"                            
##             English_top-English_bottom
## statistic   2.516081                  
## parameter   13                        
## p.value     0.01289709                
## conf.int    Numeric,2                 
## estimate    0.5964286                 
## null.value  0.5                       
## stderr      0.03832491                
## alternative "greater"                 
## method      "One Sample t-test"       
## data.name   "x"
df_mvpa_agg_E2_FFA2 %>% 
  filter(Hemisphere == "right") %>%  
  select(-Hemisphere) %>% 
  sapply(function(x) t.test(x, mu = 0.5, alternative = "greater")) # apply one-sample t-test to each column separately 
##             Chinese_intact-English_intact Chinese_intact-Chinese_exchange
## statistic   1.537708                      0.8359968                      
## parameter   18                            18                             
## p.value     0.07075658                    0.2070586                      
## conf.int    Numeric,2                     Numeric,2                      
## estimate    0.5447368                     0.5184211                      
## null.value  0.5                           0.5                            
## stderr      0.0290932                     0.02203484                     
## alternative "greater"                     "greater"                      
## method      "One Sample t-test"           "One Sample t-test"            
## data.name   "x"                           "x"                            
##             Chinese_top-Chinese_bottom English_intact-English_exchange
## statistic   -0.6012283                 1.195439                       
## parameter   18                         18                             
## p.value     0.7224076                  0.1237139                      
## conf.int    Numeric,2                  Numeric,2                      
## estimate    0.4815789                  0.5394737                      
## null.value  0.5                        0.5                            
## stderr      0.03063903                 0.03302023                     
## alternative "greater"                  "greater"                      
## method      "One Sample t-test"        "One Sample t-test"            
## data.name   "x"                        "x"                            
##             English_top-English_bottom
## statistic   0.5005797                 
## parameter   18                        
## p.value     0.3113662                 
## conf.int    Numeric,2                 
## estimate    0.5157895                 
## null.value  0.5                       
## stderr      0.03154238                
## alternative "greater"                 
## method      "One Sample t-test"       
## data.name   "x"
5.2.3.2.2 Plot
plot_mvpa_E2_FFA2 <- {
  ggplot(data = desc_mvpa_acc_E2_FFA2, aes(y = emmean, x = ClassifyPair)) + # set the data, varialbes for x and y axises
    geom_col(position = "dodge", color = "black", alpha = .7) +  # position of columns and countour of columns
    facet_grid(Hemisphere ~ .) +
    geom_errorbar(mapping = aes(ymin = lower.CL, ymax = upper.CL), linetype = 1,  # set the error bar
                  show.legend = FALSE, width = 0.25, alpha = .5,
                  position = position_dodge(width=0.9)) +
    geom_hline(yintercept = c(0.5, 1), linetype = 5, alpha = 0.5) +  # add the line for 0.5 and 1 (y)
    scale_y_continuous(expand= c(0, 0), limits = c(0, 1.1), breaks = seq(0, 1, .25)) +  # remove the space between columns and x axis
    scale_x_discrete(labels = function(x) str_wrap(x, width = 10)) + # show x labels in two rows
    labs(title = "", x = "Stimuli", y = "Accuracy") +  # set the names for main, x and y axises Subjective Responses for E205
    geom_text(label = c("***", "", "", "", "*", "*", "", "", "", ""), color = c(rep("red", 5), "blue", rep("red", 4)), size = 10, nudge_y = 0.15) + # add starts to the significant columns
    general_theme 
  # theme(axis.text.x = element_text(angle = 60, hjust = 1)) +
}

plot_mvpa_E2_FFA2

5.2.4 Label: left Visual Word Form Area (VWFA)

# label_VWFA_E2 <- label_lVWFA[1] # "roi.lh.f13.w-vs-o.label"

The label used for (left) VWFA in Experiment 1 is roi.lh.f13.w-vs-o.label.

# only keep data for these two labels
df_univar_E2_VWFA <- filter(df_univar_E2, Label %in% label_VWFA_E2) 
df_univar_agg_E2_VWFA <- filter(df_univar_agg_E2, Label %in% label_VWFA_E2)
df_mvpa_E2_VWFA <- filter(df_mvpa_E2, Label %in% label_VWFA_E2)
df_mvpa_acc_E2_VWFA <- filter(df_mvpa_acc_E2, Label %in% label_VWFA_E2)
desc_mvpa_acc_E2_VWFA <- filter(desc_mvpa_acc_E2, Label %in% label_VWFA_E2)

# subjects used for each hemisphere
# unique(as.character((df_univar_agg_E2_VWFA %>% filter(Label == label_VWFA_E2))$SubjCode))

desc_mvpa_acc_E2_VWFA %>%
  select(ExpCode, Label, Count) %>% 
  distinct()

5.2.4.1 Univariate analyses

5.2.4.1.1 rm-ANOVA
anova_E2_VWFA <- aov_4(meanResp ~ FaceWord * Layout + (1 + FaceWord * Layout | SubjCode), 
                      data = filter(df_univar_agg_E2_VWFA, Label == label_VWFA_E2))

anova_E2_VWFA
## Anova Table (Type 3 tests)
## 
## Response: meanResp
##            Effect          df  MSE         F  ges p.value
## 1        FaceWord       1, 10 0.32 41.53 ***  .36  <.0001
## 2          Layout 2.04, 20.37 0.03    3.51 * .009     .05
## 3 FaceWord:Layout 1.99, 19.86 0.05    5.26 *  .02     .01
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
## 
## Sphericity correction method: GG
emm_anova_E2_VWFA <- emmeans(anova_E2_VWFA, ~ FaceWord * Layout)

emm_anova_E2_VWFA %>% 
  as.data.frame() %>% 
  arrange(FaceWord)
contrast(emmeans(emm_anova_E2_VWFA, ~ FaceWord), "pairwise")
##  contrast          estimate    SE df t.ratio p.value
##  Chinese - English   -0.779 0.121 10 -6.444  0.0001 
## 
## Results are averaged over the levels of: Layout
contrast(emmeans(emm_anova_E2_VWFA, ~ Layout), "pairwise") # , adjust = "none"
##  contrast          estimate     SE df t.ratio p.value
##  intact - exchange -0.10704 0.0426 30 -2.514  0.0779 
##  intact - top       0.00528 0.0426 30  0.124  0.9993 
##  intact - bottom   -0.07858 0.0426 30 -1.846  0.2725 
##  exchange - top     0.11231 0.0426 30  2.638  0.0597 
##  exchange - bottom  0.02846 0.0426 30  0.668  0.9081 
##  top - bottom      -0.08386 0.0426 30 -1.970  0.2218 
## 
## Results are averaged over the levels of: FaceWord 
## P value adjustment: tukey method for comparing a family of 4 estimates
contrast(emm_anova_E2_VWFA, "pairwise", simple = "each", combine = TRUE, adjust = "none")
##  Layout   FaceWord contrast          estimate     SE   df t.ratio p.value
##  intact   .        Chinese - English -0.81413 0.1386 16.8 -5.873  <.0001 
##  exchange .        Chinese - English -0.87166 0.1386 16.8 -6.288  <.0001 
##  top      .        Chinese - English -0.51619 0.1386 16.8 -3.724  0.0017 
##  bottom   .        Chinese - English -0.91351 0.1386 16.8 -6.590  <.0001 
##  .        Chinese  intact - exchange -0.07827 0.0699 56.3 -1.120  0.2674 
##  .        Chinese  intact - top      -0.14369 0.0699 56.3 -2.056  0.0444 
##  .        Chinese  intact - bottom   -0.02889 0.0699 56.3 -0.413  0.6809 
##  .        Chinese  exchange - top    -0.06542 0.0699 56.3 -0.936  0.3532 
##  .        Chinese  exchange - bottom  0.04938 0.0699 56.3  0.707  0.4827 
##  .        Chinese  top - bottom       0.11480 0.0699 56.3  1.643  0.1060 
##  .        English  intact - exchange -0.13580 0.0699 56.3 -1.943  0.0570 
##  .        English  intact - top       0.15425 0.0699 56.3  2.207  0.0314 
##  .        English  intact - bottom   -0.12827 0.0699 56.3 -1.835  0.0717 
##  .        English  exchange - top     0.29005 0.0699 56.3  4.150  0.0001 
##  .        English  exchange - bottom  0.00753 0.0699 56.3  0.108  0.9146 
##  .        English  top - bottom      -0.28252 0.0699 56.3 -4.043  0.0002
# contrast(emm_uni_anova_E2, interaction = "pairwise") # , adjust = "none"
5.2.4.1.2 Plot
plot_uni_E2_VWFA <- {
  ggplot(data = as.data.frame(emm_anova_E2_VWFA), aes(y = emmean, x = FaceWord, fill = Layout)) + # set the data, varialbes for x and y axises
    geom_col(position = "dodge", color = "black", alpha = .7) +  # position of columns and countour of columns
    geom_errorbar(mapping = aes(ymin = lower.CL, ymax = upper.CL), linetype = 1,  # set the error bar
                  show.legend = FALSE, width = 0.25, alpha = .5,
                  position = position_dodge(width=0.9)) +
    scale_y_continuous(expand= c(0, 0), limits = c(-0.2, activationUL), breaks = seq(0, 3, .5)) +  # remove the space between columns and x axis
    labs(title = "", x = "Stimuli", y = "Beta values") +  # set the names for main, x and y axises Subjective Responses for E205
    general_theme
}

plot_uni_E2_VWFA

5.2.4.2 Multivarate analyses (MVPA)

5.2.4.2.1 One-sample t-test
df_mvpa_agg_E2_VWFA <- {
  df_mvpa_acc_E2_VWFA %>% 
  spread(ClassifyPair, Accuracy) %>% # change to table (each row is one subject)
  select(-c(ExpCode, Label, SubjCode, Count)) # remove these columns
}

df_mvpa_agg_E2_VWFA %>% 
  select(-Hemisphere) %>% 
  sapply(function(x) t.test(x, mu = 0.5, alternative = "greater")) # apply one-sample t-test to each column separately 
##             Chinese_intact-English_intact Chinese_intact-Chinese_exchange
## statistic   4.478802                      0.3885958                      
## parameter   10                            10                             
## p.value     0.0005906044                  0.3528602                      
## conf.int    Numeric,2                     Numeric,2                      
## estimate    0.6863636                     0.5136364                      
## null.value  0.5                           0.5                            
## stderr      0.04161015                    0.03509138                     
## alternative "greater"                     "greater"                      
## method      "One Sample t-test"           "One Sample t-test"            
## data.name   "x"                           "x"                            
##             Chinese_top-Chinese_bottom English_intact-English_exchange
## statistic   -0.8343875                 1.206387                       
## parameter   10                         10                             
## p.value     0.7882266                  0.1277167                      
## conf.int    Numeric,2                  Numeric,2                      
## estimate    0.45                       0.5681818                      
## null.value  0.5                        0.5                            
## stderr      0.05992419                 0.05651739                     
## alternative "greater"                  "greater"                      
## method      "One Sample t-test"        "One Sample t-test"            
## data.name   "x"                        "x"                            
##             English_top-English_bottom
## statistic   2.153251                  
## parameter   10                        
## p.value     0.02837618                
## conf.int    Numeric,2                 
## estimate    0.6181818                 
## null.value  0.5                       
## stderr      0.0548853                 
## alternative "greater"                 
## method      "One Sample t-test"       
## data.name   "x"
5.2.4.2.2 Plot
plot_mvpa_E2_VWFA <- {
  ggplot(data = desc_mvpa_acc_E2_VWFA, aes(y = emmean, x = ClassifyPair)) + # set the data, varialbes for x and y axises
    geom_col(position = "dodge", color = "black", alpha = .7) +  # position of columns and countour of columns
    facet_grid(Hemisphere ~ .) +
    geom_errorbar(mapping = aes(ymin = lower.CL, ymax = upper.CL), linetype = 1,  # set the error bar
                  show.legend = FALSE, width = 0.25, alpha = .5,
                  position = position_dodge(width=0.9)) +
    geom_hline(yintercept = c(0.5, 1), linetype = 5, alpha = 0.5) +  # add the line for 0.5 and 1 (y)
    scale_y_continuous(expand= c(0, 0), limits = c(0, 1.1), breaks = seq(0, 1, .25)) +  # remove the space between columns and x axis
    scale_x_discrete(labels = function(x) str_wrap(x, width = 10)) + # show x labels in two rows
    labs(title = "", x = "Stimuli", y = "Accuracy") +  # set the names for main, x and y axises Subjective Responses for E205
    geom_text(label = c("***", "", "", "", "*"), color = c(rep("red", 5)), size = 10, nudge_y = 0.15) + # add starts to the significant columns
    general_theme 
  # theme(axis.text.x = element_text(angle = 60, hjust = 1)) +
}

plot_mvpa_E2_VWFA

5.2.5 Label:Lateral Occipital Cortex

# label_lLOC_E2 <- label_lLOC[1] # 
# label_rLOC_E2 <- label_rLOC[1] # 

label_LOC_E2 <- c(label_lLOC_E2, label_rLOC_E2)

The label used for left LOC in Experiment 1 is roi.lh.f13.o-vs-scr.label.
The label used for right LOC in Experiment 1 is roi.rh.f13.o-vs-scr.label.

# only keep data for these two labels
df_univar_E2_LOC <- filter(df_univar_E2, Label %in% label_LOC_E2) 
df_univar_agg_E2_LOC <- filter(df_univar_agg_E2, Label %in% label_LOC_E2)
df_mvpa_E2_LOC <- filter(df_mvpa_E2, Label %in% label_LOC_E2)
df_mvpa_acc_E2_LOC <- filter(df_mvpa_acc_E2, Label %in% label_LOC_E2)
desc_mvpa_acc_E2_LOC <- filter(desc_mvpa_acc_E2, Label %in% label_LOC_E2)

# subjects used for each hemisphere
# unique(as.character((df_univar_agg_E2_LOC %>% filter(Label == label_lLOC_E2))$SubjCode))

desc_mvpa_acc_E2_LOC %>% 
  select(ExpCode, Label, Count) %>% 
  distinct()

5.2.5.1 Univariate analyses

5.2.5.1.1 rm-ANOVA
5.2.5.1.1.1 Left LOC
anova_E2_lLOC <- aov_4(meanResp ~ FaceWord * Layout + (1 + FaceWord * Layout | SubjCode), 
                      data = filter(df_univar_agg_E2_LOC, Label == label_lLOC_E2))

anova_E2_lLOC
## Anova Table (Type 3 tests)
## 
## Response: meanResp
##            Effect          df  MSE      F  ges p.value
## 1        FaceWord       1, 16 0.09 6.25 *  .01     .02
## 2          Layout 2.36, 37.70 0.04   0.95 .003     .41
## 3 FaceWord:Layout 1.92, 30.75 0.06 3.25 +  .01     .05
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
## 
## Sphericity correction method: GG
emm_anova_E2_lLOC <- emmeans(anova_E2_lLOC, ~ FaceWord * Layout)

emm_anova_E2_lLOC %>% 
  as.data.frame() %>% 
  arrange(FaceWord)
contrast(emmeans(emm_anova_E2_lLOC, ~ FaceWord), "pairwise")
##  contrast          estimate     SE df t.ratio p.value
##  Chinese - English    0.127 0.0507 16 2.501   0.0236 
## 
## Results are averaged over the levels of: Layout
contrast(emmeans(emm_anova_E2_lLOC, ~ Layout), "pairwise") # , adjust = "none"
##  contrast          estimate     SE df t.ratio p.value
##  intact - exchange  -0.0567 0.0454 48 -1.250  0.5985 
##  intact - top       -0.0729 0.0454 48 -1.607  0.3844 
##  intact - bottom    -0.0388 0.0454 48 -0.856  0.8272 
##  exchange - top     -0.0162 0.0454 48 -0.357  0.9842 
##  exchange - bottom   0.0179 0.0454 48  0.394  0.9790 
##  top - bottom        0.0341 0.0454 48  0.751  0.8758 
## 
## Results are averaged over the levels of: FaceWord 
## P value adjustment: tukey method for comparing a family of 4 estimates
contrast(emm_anova_E2_lLOC, "pairwise", simple = "each", combine = TRUE, adjust = "none")
##  Layout   FaceWord contrast          estimate     SE   df t.ratio p.value
##  intact   .        Chinese - English  0.10143 0.0785 55.8  1.292  0.2018 
##  exchange .        Chinese - English -0.01890 0.0785 55.8 -0.241  0.8107 
##  top      .        Chinese - English  0.28412 0.0785 55.8  3.618  0.0006 
##  bottom   .        Chinese - English  0.14014 0.0785 55.8  1.784  0.0798 
##  .        Chinese  intact - exchange  0.00346 0.0668 95.4  0.052  0.9588 
##  .        Chinese  intact - top      -0.16423 0.0668 95.4 -2.460  0.0157 
##  .        Chinese  intact - bottom   -0.05818 0.0668 95.4 -0.871  0.3857 
##  .        Chinese  exchange - top    -0.16769 0.0668 95.4 -2.512  0.0137 
##  .        Chinese  exchange - bottom -0.06164 0.0668 95.4 -0.923  0.3582 
##  .        Chinese  top - bottom       0.10605 0.0668 95.4  1.588  0.1155 
##  .        English  intact - exchange -0.11687 0.0668 95.4 -1.751  0.0832 
##  .        English  intact - top       0.01845 0.0668 95.4  0.276  0.7828 
##  .        English  intact - bottom   -0.01947 0.0668 95.4 -0.292  0.7712 
##  .        English  exchange - top     0.13533 0.0668 95.4  2.027  0.0455 
##  .        English  exchange - bottom  0.09740 0.0668 95.4  1.459  0.1479 
##  .        English  top - bottom      -0.03792 0.0668 95.4 -0.568  0.5714
# contrast(emm_uni_anova_E2, interaction = "pairwise") # , adjust = "none"
5.2.5.1.1.2 Right LOC
anova_E2_rLOC <- aov_4(meanResp ~ FaceWord * Layout + (1 + FaceWord * Layout | SubjCode), 
                      data = filter(df_univar_agg_E2_LOC, Label == label_rLOC_E2))

anova_E2_rLOC
## Anova Table (Type 3 tests)
## 
## Response: meanResp
##            Effect          df  MSE         F  ges p.value
## 1        FaceWord       1, 16 0.08 37.94 ***  .04  <.0001
## 2          Layout 2.50, 40.01 0.06    3.13 * .007     .04
## 3 FaceWord:Layout 2.20, 35.20 0.04      1.39 .002     .26
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
## 
## Sphericity correction method: GG
emm_anova_E2_rLOC <- emmeans(anova_E2_rLOC, ~ FaceWord * Layout)

emm_anova_E2_rLOC %>% 
  as.data.frame() %>% 
  arrange(FaceWord)
contrast(emmeans(emm_anova_E2_rLOC, ~ FaceWord), "pairwise")
##  contrast          estimate     SE df t.ratio p.value
##  Chinese - English    0.307 0.0498 16 6.160   <.0001 
## 
## Results are averaged over the levels of: Layout
contrast(emmeans(emm_anova_E2_rLOC, ~ Layout), "pairwise") # , adjust = "none"
##  contrast          estimate     SE df t.ratio p.value
##  intact - exchange   0.0851 0.0551 48  1.546  0.4188 
##  intact - top       -0.0824 0.0551 48 -1.497  0.4470 
##  intact - bottom     0.0168 0.0551 48  0.306  0.9900 
##  exchange - top     -0.1675 0.0551 48 -3.043  0.0192 
##  exchange - bottom  -0.0683 0.0551 48 -1.240  0.6048 
##  top - bottom        0.0993 0.0551 48  1.803  0.2845 
## 
## Results are averaged over the levels of: FaceWord 
## P value adjustment: tukey method for comparing a family of 4 estimates
contrast(emm_anova_E2_rLOC, "pairwise", simple = "each", combine = TRUE, adjust = "none")
##  Layout   FaceWord contrast           estimate     SE   df t.ratio p.value
##  intact   .        Chinese - English  0.202216 0.0729 51.2  2.776  0.0077 
##  exchange .        Chinese - English  0.317788 0.0729 51.2  4.362  0.0001 
##  top      .        Chinese - English  0.367403 0.0729 51.2  5.043  <.0001 
##  bottom   .        Chinese - English  0.339270 0.0729 51.2  4.657  <.0001 
##  .        Chinese  intact - exchange  0.027318 0.0701 91.1  0.390  0.6978 
##  .        Chinese  intact - top      -0.165025 0.0701 91.1 -2.353  0.0208 
##  .        Chinese  intact - bottom   -0.051700 0.0701 91.1 -0.737  0.4628 
##  .        Chinese  exchange - top    -0.192344 0.0701 91.1 -2.743  0.0073 
##  .        Chinese  exchange - bottom -0.079018 0.0701 91.1 -1.127  0.2628 
##  .        Chinese  top - bottom       0.113326 0.0701 91.1  1.616  0.1095 
##  .        English  intact - exchange  0.142891 0.0701 91.1  2.038  0.0445 
##  .        English  intact - top       0.000162 0.0701 91.1  0.002  0.9982 
##  .        English  intact - bottom    0.085355 0.0701 91.1  1.217  0.2267 
##  .        English  exchange - top    -0.142729 0.0701 91.1 -2.035  0.0447 
##  .        English  exchange - bottom -0.057536 0.0701 91.1 -0.821  0.4141 
##  .        English  top - bottom       0.085193 0.0701 91.1  1.215  0.2275
# contrast(emm_uni_anova_E2, interaction = "pairwise") # , adjust = "none"
5.2.5.1.2 Plot
# add the column of Hemisphere
nRow_E2 <-nrow(as.data.frame(emm_anova_E2_lLOC))
Hemisphere <- c(rep("left", nRow_E2), rep("right", nRow_E2))
desp_uni_E2_LOC <- cbind(Hemisphere, rbind(as.data.frame(emm_anova_E2_lLOC), as.data.frame(emm_anova_E2_rLOC)))

plot_uni_E2_LOC <- {
  ggplot(data = desp_uni_E2_LOC, aes(y = emmean, x = FaceWord, fill = Layout)) + # set the data, varialbes for x and y axises
    geom_col(position = "dodge", color = "black", alpha = .7) +  # position of columns and countour of columns
    facet_grid(Hemisphere ~ .) +
    geom_errorbar(mapping = aes(ymin = lower.CL, ymax = upper.CL), linetype = 1,  # set the error bar
                  show.legend = FALSE, width = 0.25, alpha = .5,
                  position = position_dodge(width=0.9)) +
    scale_y_continuous(expand= c(0, 0), limits = c(0, activationUL), breaks = seq(0, 3, .5)) +  # remove the space between columns and x axis
    labs(title = "", x = "Stimuli", y = "Beta values") +  # set the names for main, x and y axises Subjective Responses for E205
    general_theme
}

plot_uni_E2_LOC

5.2.5.2 Multivarate analyses (MVPA)

5.2.5.2.1 One-sample t-test
df_mvpa_agg_E2_LOC <- {
  df_mvpa_acc_E2_LOC %>% 
  spread(ClassifyPair, Accuracy) %>% # change to table (each row is one subject)
  select(-c(ExpCode, Label, SubjCode, Count)) # remove these columns
}

df_mvpa_agg_E2_LOC %>% 
  filter(Hemisphere == "left") %>%  
  select(-Hemisphere) %>% 
  sapply(function(x) t.test(x, mu = 0.5, alternative = "greater")) # apply one-sample t-test to each column separately 
##             Chinese_intact-English_intact Chinese_intact-Chinese_exchange
## statistic   6.687594                      0.5070201                      
## parameter   16                            16                             
## p.value     2.607832e-06                  0.3095284                      
## conf.int    Numeric,2                     Numeric,2                      
## estimate    0.7705882                     0.5147059                      
## null.value  0.5                           0.5                            
## stderr      0.04046122                    0.02900453                     
## alternative "greater"                     "greater"                      
## method      "One Sample t-test"           "One Sample t-test"            
## data.name   "x"                           "x"                            
##             Chinese_top-Chinese_bottom English_intact-English_exchange
## statistic   4.763097                   2.041168                       
## parameter   16                         16                             
## p.value     0.0001058414               0.02904294                     
## conf.int    Numeric,2                  Numeric,2                      
## estimate    0.6058824                  0.5705882                      
## null.value  0.5                        0.5                            
## stderr      0.02222973                 0.03458228                     
## alternative "greater"                  "greater"                      
## method      "One Sample t-test"        "One Sample t-test"            
## data.name   "x"                        "x"                            
##             English_top-English_bottom
## statistic   5.967033                  
## parameter   16                        
## p.value     9.857183e-06              
## conf.int    Numeric,2                 
## estimate    0.6676471                 
## null.value  0.5                       
## stderr      0.02809555                
## alternative "greater"                 
## method      "One Sample t-test"       
## data.name   "x"
df_mvpa_agg_E2_LOC %>% 
  filter(Hemisphere == "right") %>%  
  select(-Hemisphere) %>% 
  sapply(function(x) t.test(x, mu = 0.5, alternative = "greater")) # apply one-sample t-test to each column separately 
##             Chinese_intact-English_intact Chinese_intact-Chinese_exchange
## statistic   5.456572                      1.503266                       
## parameter   16                            16                             
## p.value     2.637871e-05                  0.07612559                     
## conf.int    Numeric,2                     Numeric,2                      
## estimate    0.7441176                     0.5529412                      
## null.value  0.5                           0.5                            
## stderr      0.04473828                    0.03521744                     
## alternative "greater"                     "greater"                      
## method      "One Sample t-test"           "One Sample t-test"            
## data.name   "x"                           "x"                            
##             Chinese_top-Chinese_bottom English_intact-English_exchange
## statistic   2.296741                   2.897629                       
## parameter   16                         16                             
## p.value     0.01773599                 0.005246257                    
## conf.int    Numeric,2                  Numeric,2                      
## estimate    0.5823529                  0.5823529                      
## null.value  0.5                        0.5                            
## stderr      0.03585643                 0.02842081                     
## alternative "greater"                  "greater"                      
## method      "One Sample t-test"        "One Sample t-test"            
## data.name   "x"                        "x"                            
##             English_top-English_bottom
## statistic   1.539795                  
## parameter   16                        
## p.value     0.07157628                
## conf.int    Numeric,2                 
## estimate    0.5617647                 
## null.value  0.5                       
## stderr      0.0401123                 
## alternative "greater"                 
## method      "One Sample t-test"       
## data.name   "x"
5.2.5.2.2 Plot
plot_mvpa_E2_LOC <- {
  ggplot(data = desc_mvpa_acc_E2_LOC, aes(y = emmean, x = ClassifyPair)) + # set the data, varialbes for x and y axises
    geom_col(position = "dodge", color = "black", alpha = .7) +  # position of columns and countour of columns
    facet_grid(Hemisphere ~ .) +
    geom_errorbar(mapping = aes(ymin = lower.CL, ymax = upper.CL), linetype = 1,  # set the error bar
                  show.legend = FALSE, width = 0.25, alpha = .5,
                  position = position_dodge(width=0.9)) +
    geom_hline(yintercept = c(0.5, 1), linetype = 5, alpha = 0.5) +  # add the line for 0.5 and 1 (y)
    scale_y_continuous(expand= c(0, 0), limits = c(0, 1.1), breaks = seq(0, 1, .25)) +  # remove the space between columns and x axis
    scale_x_discrete(labels = function(x) str_wrap(x, width = 10)) + # show x labels in two rows
    labs(title = "", x = "Stimuli", y = "Accuracy") +  # set the names for main, x and y axises Subjective Responses for E205
    geom_text(label = c("***", "", "***", "*", "***", "***", "*", "*", "**", "*"), color = c(rep("red", 6), "blue", rep("red", 2), "blue"), size = 10, nudge_y = 0.15) + # add starts to the significant columns
    general_theme 
  # theme(axis.text.x = element_text(angle = 60, hjust = 1)) +
}

plot_mvpa_E2_LOC

6 Versions of packages used

# rstudioapi::versionInfo()
sessionInfo()
## R version 3.6.1 (2019-07-05)
## Platform: x86_64-apple-darwin15.6.0 (64-bit)
## Running under: macOS Mojave 10.14.5
## 
## Matrix products: default
## BLAS:   /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRblas.0.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib
## 
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
##  [1] emmeans_1.4.2   lmerTest_3.1-0  afex_0.25-1     lme4_1.1-21    
##  [5] Matrix_1.2-17   forcats_0.4.0   stringr_1.4.0   dplyr_0.8.3    
##  [9] purrr_0.3.3     readr_1.3.1     tidyr_1.0.0     tibble_2.1.3   
## [13] ggplot2_3.2.1   tidyverse_1.2.1
## 
## loaded via a namespace (and not attached):
##  [1] httr_1.4.1          jsonlite_1.6        splines_3.6.1      
##  [4] carData_3.0-3       modelr_0.1.5        assertthat_0.2.1   
##  [7] cellranger_1.1.0    yaml_2.2.0          numDeriv_2016.8-1.1
## [10] pillar_1.4.2        backports_1.1.5     lattice_0.20-38    
## [13] glue_1.3.1          digest_0.6.22       rvest_0.3.5        
## [16] minqa_1.2.4         colorspace_1.4-1    htmltools_0.4.0    
## [19] plyr_1.8.4          pkgconfig_2.0.3     broom_0.5.2        
## [22] haven_2.2.0         xtable_1.8-4        mvtnorm_1.0-11     
## [25] scales_1.0.0        openxlsx_4.1.3      rio_0.5.16         
## [28] generics_0.0.2      car_3.0-5           ellipsis_0.3.0     
## [31] withr_2.1.2         lazyeval_0.2.2      pbkrtest_0.4-7     
## [34] cli_1.1.0           magrittr_1.5        crayon_1.3.4       
## [37] readxl_1.3.1        estimability_1.3    evaluate_0.14      
## [40] nlme_3.1-140        MASS_7.3-51.4       xml2_1.2.2         
## [43] foreign_0.8-71      tools_3.6.1         data.table_1.12.6  
## [46] hms_0.5.2           lifecycle_0.1.0     munsell_0.5.0      
## [49] zip_2.0.4           compiler_3.6.1      rlang_0.4.1        
## [52] grid_3.6.1          nloptr_1.2.1        rstudioapi_0.10    
## [55] rmarkdown_1.16      boot_1.3-22         gtable_0.3.0       
## [58] abind_1.4-5         curl_4.2            reshape2_1.4.3     
## [61] R6_2.4.0            lubridate_1.7.4     knitr_1.25         
## [64] zeallot_0.1.0       stringi_1.4.3       parallel_3.6.1     
## [67] Rcpp_1.0.3          vctrs_0.2.0         tidyselect_0.2.5   
## [70] xfun_0.10           coda_0.19-3
 

A work by Haiyang Jin